307 Temporary Redirect is a response HTTP status code that indicates the requested resource has been moved to a different URL for a limited period of time. Unlike a 301 permanent redirect, the 307 Temporary Redirect message indicates that the change is temporary and the request method is not changed.
It is important to fix the unexpected 307 https response code, as it can have a negative impact on performance, tracking, and user experience, all of which can damage your website’s SEO score.
What Does 307 Temporary Redirect Mean?
When a client requests a given online resource, the responsible web server fetches this online resource and returns it to the user. This is the simplest explanation of how the Internet works. However, there can be various issues that stunt the process. In the context of 307 Temporary Redirect, the page you asked to browse is temporarily moved to a different address, and the server is telling your web browser two things: the requested resource is currently located at another URL, and the user should go to a different address to fetch it for now.
In short, 307 simply tells you that whatever you search for is not here, but in another place. This is an important indication, as it clearly tells you several things:
- Don’t update your browser bookmarks permanently right now.
- Don’t think this URL is the final and forever version.
- Remember, this is a short-term redirect.
What Causes Error 307 Temporary Redirect
307 Temporary Redirect appears when multiple layers are being triggered at once – CDN, proxy, web server, and an app. Below are some of the most common causes for triggering Error 307 Redirects:
HTTP Enforcement Loops
This is a well-known redirect loop that oftentimes triggers error messages. In this scenario, one system forces HTTP to HTTPS. Then, another system forces HTTPS to HTTP. In such a situation, the web browser keeps bouncing between versions endlessly and therefore prompts the 307 error message.
Read Also: How Does HTTP Work
Reverse Proxy and CDN Rules
Should you use CDN or a reverse proxy, the settings can generate redirects before the requests even reach the resource. In these scenarios, the problem is that redirect logic is separated into two places; for example, Cloudflare forces the HTTPS version, while your origin also forces HTTPS. Another reason might be the incorrect forwarding of headers, so they “correct” the URL with a redirect.
Broken Rewrite Rules in Config Files
Misconfigured rules in .htaccess and nginx.conf files can oftentimes result in a 307 Error prompt. In this scenario, the causes vary, but the most common are:
- Old rules were copied from another setup.
- Rules overlap. For example, an HTTPS redirect overlaps with a canonical redirect and a trailing slash redirect.
- There can be an intentional application of a rewrite rule in an Apache server.
Such occasions can result in various unwanted results that prompt a 307 Temporary Redirect. Such are:
- Forcing / vs no /
- Forcing lowercase URLs
- Redirecting “index.php” to clean URLs
- Redirecting to a different domain or a subdomain.
App-based Redirects (WordPress, other CMS platforms, and Frameworks)
Sometimes the web servers might be functioning just fine, yet you still get 307 redirects. This can happen with CMS platforms such as WordPress or with various frameworks. In such a situation, the server is delivering a response from the CMS or the framework, and those apps are sending a redirect status code along with a Location header. What happens is that such software platforms misunderstand what is going on. Typical examples of such behaviour include:
- CMS and frameworks force the HTTPS version over HTTP
- CMS and frameworks force the www version of a website over non-www versions.
- Such platforms make users choose language versions such as /en-us/
To be sure that such behaviour is indeed the root of the cause, you should isolate other possible causes. To do so, follow these steps:
First, disable the server redirects and check whether the error message is still present. If it is, then check whether the redirect is focused on login, local, and canonical URL targets
Redirecting a POST Request Unintentionally
A common cause of 307 Temporary Redirect is a redirected POST request after the use of forms and APIs. In such cases, the 307 temporary redirects indicate that the HTTP method is preserved. In short, the redirected POST remains POST as it should be, but can still cause errors should the destination route not be meant to accept a POST request.
From the point of view of a client, the issue often looks like this:
- The contact form refreshes without anything happening – it is not saved, sent, or processed in any way.
- The payment process doesn’t work; nothing happens after the Pay Now button is clicked, although all the required data is entered.
- The login page reloads without opening the next page of the process.
How to Fix 307 Temporary Redirect
Fixing the 307 Temporary Redirect is possible after finding which layer is forcing the redirect and fixing the conflicts. As stated, many cases indicate 307 error message is prompted by misconfiguration, a redirect loop, or a redirect chain issue. Among other negative results, the redirect response can harm user experience and contribute to a negative SEO performance for search engines.
Luckily, there are many ways you can fix the issue and get your website up and running in no time. Here’s how to proceed.
The first thing you need to do is to identify the redirect source. This means that, before jumping to fast conclusions, it is important to confirm what exactly causes the status code and where the redirect points to.
To do so, first follow these steps:
- First, open your DevTools on your browser and head to Network
- After that, reload the page that displays the 307 Error message.
- Once the page reloads, click the request that returns the Temporary Redirect issue.
- The next step is to find the Location header somewhere in the Response Header section.
The location header can help you with figuring out the destination, and can also help you notice issues such as HTTP to HTTPS forcing, www to non-www website version, trailing slashes normalization, and various authentication redirects.
This first step is important, as it can help you see how redirection works in your specific case, so you avoid some random guesswork.
Then, follow those suggestions to fix the problem.
Eliminate Redirect Loops (HTTP to HTTPS to HTTP)
Redirect loops are a common cause for a 307 Temporary Redirect message. Such loops happen with redirecting from HTTP version to HTTPS and back again, redirecting from the www version of your website to the non-www. version, and bouncing between trailing slash to no slash to trailing slash again.
To fix those issues, you need to choose one layer and enforce canonical rules. Those include:
- CDN/Proxy or
- web server or
- application.
However, you need to choose one and not all 3 at the same time. For example, if your CDN forces HTTPS, don’t force HTTPS at the same origin, as this can cause issues. This happens because when numerous systems attempt to fix the URL, most often the result is not a fix, but a chain of HTTP status code such as 307 to 302 redirect to 307 Temporary Redirect.
Check CDN Settings
Should you use a CDN or a proxy server, they might trigger redirects before even the request reaches your CMS or framework. To see whether this causes the issue, check those options:
- “Always Use HTTPS” or any other options that force HTTPS.
- Check for page rules for redirecting www to the non-www version of your website.
- Also, take a look at the origin headers and scheme handling.
It is important to check such options because, in case the proxy server sends incorrect scheme and host data to the origin, your website app may determine the request is wrong and prompt a redirect in order to “fix it”, but in reality, what happens is that this “fix” prompts a redirecting chain.
Check the Web Server’s Redirect Rules (for Apache and Nginx)
It is a good idea to check your configuration file to check for some unwanted redirect and rewriting rules.
If you are using an Apache server, check the .htaccess file and look for Redirect 307, some rules that force temporary redirects, such as 307, and overlapping rules. Should the move be permanent, replace all temporary rules with a 301 redirect to permanently redirect the old path to this new one.
If you are using an Nginx server, look for “return 307…;, rewrite….redirect; and other rules that normalize the slash/case or change domains. In this case, you should be careful with the rule overlap. This means that if you have a separate server block for HTTP that redirects to the HTTPS version, do not edit it again inside the HTTPS block.
Fix App-Level Redirect Chains (WordPress, other CMS Platforms and Frameworks)
Should the server serup looks fine, and your website is based on a CMS or a framework, then the redirect issue may be coming directly from the application. Here’s how to proceed.
Should you be using WordPress:
- First, verify that the Site URL and Home URL match the correct domain and HTTP/HTTPS version.
- Then, check for faulty plugins – disable plugins that force canonical URLs, redirection, security rules, and language rooting. Should your website stop displaying the 307 Temporary Redirect message this way, then the issue is rooted in one of those plugins. To isolate the faulty one, enable them one by one and refresh your website until the point you see the error message – when it appears after a given plugin is enabled, then this is the root of your problems. Delete it or contact customer support for further assistance.
- If the redirecting plugins are not causing any issue, proceed with checking out whether some of the caching plugins are causing the trouble. Just follow the same pattern as with the redirection plugins.
Should you be using any Framework, here are some common fixes:
- Check whether some middleware forces login, locale, or canonical routing.
- Ensure that the app is correctly detecting HTTPS when it is used behind a proxy. In this scenario, the app should already know that HTTPS is used, so it doesn’t prompt a redirect loop.
Fix the POST Request Redirects
Given that the 307 temporary redirect error message preserves the method, if a form sends a post request to a URL that redirects, the web browser will send the same POST again to the redirected URL. Should the destination route not accept the POST, the entire process can fail, and therefore, the 307 Temporary Redirect message be displayed.
Some common causes for this issue include:
- /submit is redirecting to /submit/
- HTTP endpoint redirects to HTTPS during form submission.
- The www or non-www version redirect happens during POST.
- Locale redirect triggers on POST routes.
Some of the fixes you can apply in this situation are to update the form action and endpoint to use the final canonical URL directly. Another fix includes exempting POST endpoints from trailing slash normalization, or applying canonical redirects to GET pages.
Conclusion – How to Fix 307 Temporary Redirect
The 307 Temporary Redirect means that a resource is moved only for a given period of time, and the server is telling the browser to get it from another URL. This instruction comes via the Location header.
To fix the issue, tho should identify where the redirect is coming from, remove the overlapping rules, and make sure that the redirects match your intent. In case the redirect is really temporary, 307 may be the thing you need. However, if the change should remain permanent, switching to a 301 redirect may appear as the better option.
Always make sure to pay attention to forms and APIs when tackling the root cause of 307 Temporary Redirect. This means that redirecting a post request remains one of the most common causes for the 307 error message.
