What is HTTP 428 Status Code (Precondition Required)?

Reliqus Marketing

04 June 2024

HTTP Status Codes
By Ankit Bhatia
Founder & CEO

For many website owners and developers, the HTTP 428 Status Code can be a source of frustration. Its implications are often misunderstood, leading to confusion and a sense of being lost when trying to troubleshoot website errors.

The 428 error code, if not handled properly, can disrupt the normal functioning of a website and significantly hinder user experience. Without a clear understanding of how to address this status code, website owners may struggle to maintain their site’s performance and reliability, potentially leading to frustrated users and a negative impact on their business.

At Reliqus Consulting, we believe in empowering website owners and developers with comprehensive knowledge about the 428 HTTP Status Code. Understanding its significance and knowing how to handle this error effectively can give you the confidence to troubleshoot and resolve issues with ease.

What Does HTTP 428 Status Code Mean?

A 428 status code is part of the HTTP/1.1 protocol and stands for “Precondition Required.” It indicates that the origin server requires the request to be conditional. 

This typically involves the absence of necessary precondition headers in the client’s request, such as If-Match. 

These headers are crucial for the server to evaluate whether the request can be processed in its current state or under current policies. If these preconditions are not met or properly provided, the server responds with a 428 HTTP response status code, signalling the need for the client to include these precondition headers in their request.

Source: RFC6585 Section 3

When is a 428 Precondition Required Status Code Used?

The HTTP 428 status code is used to prevent the “lost update” problem in web applications. This issue arises when a client retrieves (GETs) a resource’s state, modifies it, and then attempts to update (PUT) it back on the server, but in the meantime, a third party has already modified the server’s state of the same resources resulting in a conflict.

The server can ascertain that the client is working on the most current version. Consequently, the 428 Precondition Required HTTP status code plays a critical role in maintaining data integrity and consistency across client-server interactions.

A response with 428 HTTP status code SHOULD explain how to resubmit the request successfully. For example:

HTTP/1.1 428 Precondition Required
Content-Type: text/html

<html>
<head>
<title>Precondition Required</title>
</head>
<body>
<h1>Precondition Required</h1>
<p>This request is required to be conditional; try using “If-Match”.</p>
</body>
</html>

A cache MUST NOT store the 428 Response status code.

HTTP 428 Status Code References

Symfony HTTP Status Constant Response::HTTP_PRECONDITION_REQUIRED

.NET HttpStatusCode.PreconditionRequired

Rust http::StatusCode::PRECONDITION_REQUIRED

Rails :precondition_required

Go http.StatusPreconditionRequired

Symfony Response::HTTP_PRECONDITION_REQUIRED

Python 3.5+ http.HTTPStatus.PRECONDITION_REQUIRED

Apache HttpComponents Core org.apache.hc.core5.http.HttpStatus.SC_PRECONDITION_REQUIRED

Angular @angular/common/http/HttpStatusCode.PreconditionRequired

428 HTTP Response Status Code Example

The following example shows the request and response for a 428 status code:

Request

GET /example HTTP/1.1

Host: www.example.com

Response

HTTP/1.1 428 Precondition Required

Date: Mon, 07 Mar 2023 16:30:00 GMT

Content-Type: text/html; charset=UTF-8

Content-Length: 114

<!DOCTYPE html>

<html>

<head>

<title>428 Precondition Required</title>

</head>

<body>

<h1>428 Precondition Required</h1>

<p>The origin server requires the request to be conditional.</p>

</body>

</html>

What Causes an HTTP 428 Status Code Error?

A 428 Precondition Required status code is a specific HTTP response that signals a requirement from the server before a request can be fulfilled. This particular code is a server’s way of indicating that the request from the client lacks certain conditions that need to be met. Typically, this involves the client having to include one or more preconditions in the request headers.

Common triggers for a 428 HTTP status code encompass a range of requirements the server might have.

  • The server requires a particular version of the resource.
  • The server requires the client to authenticate itself before it allows access to the requested resources. 
  • The server might also specify the need for a particular MIME type for the requested resource, or the server might also require specific headers to be present in the request before it can be processed.

Upon encountering a 428 HTTP Response status code, the client must review the request headers to verify that all the server’s required preconditions are indeed included. Modifications to the request headers or adding additional information might be necessary to align with the server’s stipulations.

How does HTTP 428 Precondition Required Status Code Impact SEO?

Understanding the 428 HTTP Response Status Code is crucial for SEO as it directly impacts several key factors:

  • Crawl Efficiency: Frequent 428 errors can hinder search engines’ ability to crawl your site effectively. This may lead to delayed indexing or problems in reflecting updates, negatively impacting your site’s perceived availability and reliability.
  • User Experience: Encountering HTTP 428 status code errors can result in a poor user experience, which is detrimental to SEO. High bounce rates resulting from such experiences can diminish your site’s rankings over time.
  • Site Performance: The regular occurrence of 428 errors might signify underlying issues in request handling, potentially degrading your site’s performance. Given that site speed is a significant SEO factor, unresolved 428 status code errors could unfavourably influence your search engine rankings.

Reliqus Consulting understands the significance of mastering HTTP status codes for the development and maintenance of efficient and reliable web applications. For more detailed explanations and resources about different HTTP status codes, including HTTP 428, check out our detailed guide on HTTP Status Codes

What are the Related HTTP Response Headers with 428 HTTP Status Codes?

Understanding the 428 Precondition Required status code involves exploring related HTTP response headers that interact with this status. These headers play a crucial role in conditional requests and preconditions:

1. HTTP Conditional Requests: The concept of conditional requests in HTTP allows the result and even success of a query to be modified by comparing the affected resources with a validator. Such requests are used to validate the contents of a cache in order to avoid redundant control or verify the integrity of a document, such as when resuming downloads or preventing lost updates when uploading or changing documents.

2. If-Match HTTP Header: It makes the request conditional, meaning the server will process the request only if the requested resource matches one of the listed ETags for the GET and HEAD methods. If this is the case, PUT and other unsafe methods will only upload the resource.

How to Troubleshoot a 428 Precondition Required Status Code?

Troubleshooting an HTTP 428 status code can be a meticulous process, but understanding the right steps can significantly ease the resolution. 

Here are the key measures to consider:

  • Ensure that the user agent is accurately sending the required Prefer header with the request. The Prefer header should contain the value handling=lenient to indicate that the server can process the request under the lenient conditions.
  • Confirm that the server is correctly interpreting the Prefer header. The server needs to recognize when the handling directive is not set to lenient and, as a result, return a 428 HTTP status code.
  • Look for any headers or directives that might be in conflict, leading to the 428 status code error
  • Check that the client has the necessary access rights or permissions to the resource they are requesting. Lack of sufficient permissions is a common cause for receiving a 428 error code.
  • Ensure the server has the required resources available to fulfil the request. A server lacking the necessary resources may issue a 428 response status code as it cannot process the request under the current conditions.

Following these troubleshooting steps should help identify and resolve the issue causing a 428 error. If the problem persists, reaching out to the website administrator for further assistance might be the next best step.

Conclusion

Understanding and correctly implementing HTTP status codes like 428 Precondition Required is just one of the many details that highlight the depth of technical expertise we provide at Reliqus Consulting

If you’re facing challenges with web development or just want to ensure your applications are up to the standards of today’s web requirements, don’t hesitate to reach out to us at Reliqus Consulting. You can contact us directly at +1 (424) 999-8252 or via email at info@reliqus.com. Our team of experts is always ready to assist you in navigating the digital landscape with effective and innovative solutions.

For more information about our services and expertise, please visit our website. We look forward to helping you transform your digital strategies into successful realities.

FAQS

How to Check HTTP 428 Status Code? 

To diagnose a 428 HTTP Status Code, utilize the web browser’s network tab and developer tools to inspect each resource request made by the client.

What is the Browser’s Compatibility with 428 Response Status Codes? 

The HTTP 428 status code is fully supported across all major browsers, including Chrome, Edge, Firefox, Internet Explorer, Opera, Safari, and WebView on Android, ensuring broad compatibility. 

How do I fix the 428 Preconditions Required Error? 

To resolve a 428 precondition status code required error, determine why the server demands specific conditions. This may involve reviewing conditional headers, server configurations, or API request conditions. Adjustments to server settings or client-side application updates may be necessary to comply with these requirements.

What is the HTTP 428 error on Google? 

HTTP 428 Status Code Error on Google indicates that the server requires the request to be conditional. While not specific to Google, it can affect how Google’s web crawlers interact with your site, requiring specific conditions to be met by the client before proceeding.

Ankit Bhatia

Founder & CEO at Reliqus

With 12+ years of experience building a web presence for 300+ businesses, Ankit understands how businesses can use technology to increase revenue.

Latest from the blog

How to Set Up, Optimize, and Maximize Your Google My Business Listing: A Complete Guide

In today’s digital landscape, having a Google My Business (GMB) account is essential for any business seeking to attract local customers. Not o...

SEO  

How to Rank for “Near Me” Keywords: A Comprehensive Guide for Local Businesses

Have you ever typed in a search like “restaurants near me,” “hotels near me,” or “things to do near me”? We’ve all done it. These a...

How to Efficiently Search a Website for Keywords?

In today’s digital world, knowing how to search a website for keywords can significantly boost your SEO efforts. Whether you’re optim...

SEO  

The Best SEO Conferences to Attend in 2024-2025 (Virtual And In-Person)

If you’re serious about SEO and want to stay ahead of the curve, attending SEO conferences is a must. These events aren’t just gather...

SEO