Web application redirects from http to https with 307 when HSTS is implemented in config file

Gangurde, Dilip 0 Reputation points
2025-07-24T11:07:03.21+00:00

Hello,

I am hosting a webservice through Azure front door. I have implemented routing rule to redirect http request to https with 301 redirect type.

My application also uses HSTS header in web config file.

Every time, I enter http request in url, the redirect is done using 307 and not 301. Any idea why it does not redirect using 301 as defined in azure front door?

Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Srikanth Reddy Bandi 90 Reputation points Microsoft External Staff Moderator
    2025-08-04T05:57:19.48+00:00

    Hello Gangurde, Dilip,

    Thanks for reaching out to Microsoft Q&A.

    You’re seeing a 307 redirect instead of a 301 because HSTS is enabled. With HSTS, browsers automatically redirect HTTP requests to HTTPS, so when you access the web service without HTTPS, the browser manages the redirect, which overrides any custom 301 rules you set.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.