c# - HTTP redirection issue in IIS, keep getting ERR_TOO_MANY_REDIRECTS on the browser -
i trying enable https on website on iis. want redirect user http https.
i have updated rule accordingly in web.config to
<rewrite> <rules> <rule name="redirect https" enabled="true" stopprocessing="true"> <match url="(.*)" /> <conditions> <add input="{https}" pattern="^off$" /> </conditions> <action type="redirect" url="https://{http_host}/" redirecttype="permanent" /> </rule> </rules> </rewrite>
i able convert request https keeps redirecting same url https. problem rule apparently keeps redirecting urls including https , browser in network tab keeps lots of 301 , throws
this webpage has redirect loop
err_too_many_redirects
please me out here if has tackled similar situation. can provide more information if necessary.
thank you
try following rewrite rule. work websites served single iis server. load balanced environments or server firms need tweaks.
<rewrite> <rules> <rule name="redirect https" enabled="true" stopprocessing="true"> <match url="(.*)" /> <conditions> <add input="{https}" pattern="off" /> </conditions> <action type="redirect" redirecttype="permanent" url="https://{http_host}/{r:1}" /> </rule> </rules> </rewrite>
you can have @ question , solution here