Reputation: 210
I use IIS 6.2 to host a website and I've set up the rewrite module to automatically redirect HTTP requests to HTTPs. Using a brownser on incognito mode, when I request for the http:// version it doesn't redirect to the HTTPs version. Then, when I reload the page I correctly get the HTTPs version.
I've tried both with appendQueryString true and false.
Here is my web.config rewrite part:
<rewrite>
<rules>
<rule name="HTTPS force" enabled="false" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" appendQueryString="false" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
I expect that every request will be served as HTTPs. I would not want to see "Not secure" on the browser tab.
Upvotes: 0
Views: 646
Reputation: 12789
please check your rule.i think this is not enabled. use below rule:
<rule name="Force SSL" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" appendQueryString="true" redirectType="Permanent" />
</rule>`
also, enable append query string otherwise this rule will not add query string value in url.
Regards, Jalpa
Upvotes: 1