Redirect from HTTP to HTTPS returns 307 instead of 301 on Cloudflare

What is the name of the domain?

example.com

What is the issue you’re encountering

I’m currently using Cloudflare for my website, and I’ve noticed that the redirect from HTTP to HTTPS is returning a 307 Temporary Redirect status code instead of a 301 Moved Permanently. I would prefer to use a 301 redirect for SEO and caching purposes. I’ve checked my Cloudflare settings: The “Always Use HTTPS” option is enabled under SSL/TLS > Edge Certificates. I don’t have any Page Rules that might be causing this. My SSL/TLS encryption mode is set to “Full (strict)”. I’ve also verified that my server isn’t overriding the redirect with a 307 response. Does anyone know how I can configure Cloudflare (or my server) to ensure the redirect uses a 301 status code instead of 307? Any help would be greatly appreciated! Thanks in advance.

If you can give the real site it is easier to check, but the 307 redirect may be due to your browser and caused by HSTS.

1 Like

Oh, you’re right! The first time I checked it in Google Chrome, but now I checked it using CURL and Firefox, and it works fine. Thank you! :pray:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.