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


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -