An HTTP redirect (also called URL forwarding) is a mechanism that automatically routes clients to resources hosted at another URL address, instead of using the original URL. The goal is to redirect clients to other web pages, applications, or servers — when the intended resource is outdated or unavailable — or to cloned resources for high availability.
The HTTP redirect (or redirection) feature has existed for decades. It was initially defined under RFC 1945 as part of the HTTP/1.0 specification in 1996. Since then, the redirect function and its associated HTTP error codes have evolved to meet modern standards.
How do HTTP redirects work?
HTTP redirects can be temporary or permanent. They're error-correction mechanisms that prevent users from accessing broken links, ensure that clients are speaking to the server securely, stop users from landing on dysfunctional pages, and avoid other potential frustrations during their session.
An HTTP redirect may not always prevent clients from receiving an HTTP 3xx category of error codes, however. These signal that a redirection has occurred or was attempted — giving the user some context without revealing too much backend logic. Here are some common error codes:
301 (Moved Permanently) – All current and subsequent client requests will be rerouted to a new resource.
302 (Moved Temporarily or Found) – The browser is encouraged to make a follow-up request for another resource hosted at another location, until the reason for the redirect is resolved.
303 (See Other) – The server cannot locate something representative of the target resource, and the browser is instructed to perform a
GETrequest to obtain the intended resource.307 (Temporary Redirect) – Requests using HTTP/1.1 or later can perform a CRUD operation (such as
POST) again when the initial method fails. This distinguishes a 307 response from a 302 response.308 (Permanent Redirect) – The server tells the browser that the requested resource is now located at another URL. The browser can request this moved resource if it's mentioned within the HTTP request's
Locationheader.
A redirect landing page can also point users to another URL that better matches their intent. In any case, a redirect either tells the client what went wrong or how to proceed. This is meant to provide a smoother browsing experience. Here's a generic HTTP header example that incorporates an error code listed above:
HTTP/2 301
cache-control: max-age=180,public
location: /docs/HAProxy_configuration/ConfigManual/algorithms/types
content-type: text/plain; charset=utf-8
date: Wed, 17 Dec 2025 11:03:34 EST
Moved Permanently. Redirecting to /enterprise/docs/HAProxy_configuration/ConfigManual/algorithms/typesHere's how the HTTP redirect process works:
The client sends an HTTP request to the web server for a specific resource, using a CRUD operation such as
GETorPOST.The server receives this request and performs a lookup of said resource within the database.
The web server or load balancer checks the URL against a list of rules to determine if it should be redirected — for example, redirecting all HTTP requests to an equivalent HTTPS URL.
If the server locates the resource at the intended URL, it responds by serving the content or connecting to the service.
If the server fails to locate the resource at the original URL, it returns an error code and brief message through the browser. This tells the browser how to proceed while letting the user know what happened. It can also automatically redirect the user to a new page using embedded HTTP response header information.
When redirects happen and error codes are returned, they're intentionally kept vague. Offering more information could pose a security risk and enable attackers to target vulnerable web servers more easily.
You’ve mastered one topic, but why stop there?
Our blog delivers the expert insights, industry analysis, and helpful tips you need to build resilient, high-performance services.
Does HAProxy support HTTP redirects?
Yes! HAProxy and HAProxy One support custom rules that enable HTTP redirects to reroute HTTP traffic — including HTTP to HTTPS. These send redirect responses to the client and instruct them to make a new request to the updated resource. HAProxy uses the http-request redirect configuration directive to send responses directly to the client.
To learn more about HTTP redirect support in HAProxy, check out our HTTP redirects documentation or our HAProxy & HTTP Strict Transport Security (HSTS) blog post.