<div dir="ltr"><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">Hello again,</div><div class="gmail_extra"><br><div class="gmail_quote">I resorted to the "if" control structure because, without it, the<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
browser became stuck in a redirect-loop. (The reason for this is<br>
obvious.) Then again, I suppose that the redirect-loop would occur<br>
regardless of whether I use a "return 301" or "rewrite".<br>
<br>
How would you recommend avoiding the redirect-loop problem?<br>
<br></blockquote><div><br><div class="gmail_default" style="font-size:small;color:rgb(51,51,153);display:inline">To me, it seems that if you have an infinite llop problem, the redirect condition is not correct.<br></div>
<div class="gmail_default" style="font-size:small;color:rgb(51,51,153);display:inline">I would redirect URI starting with 'http://' to the same starting with 'https://'. Once the 'https' location is requested, the redirect has no effect anymore... with the supplemental benefit of Nginx automatically</div>
<div class="gmail_default" style="font-size:small;color:rgb(51,51,153);display:inline">sending a permanent 301 redirection and not a temporary 302 one (which is the default, unless explicitly stated otherwise, if I remember well).<br>
<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I would really prefer no to have to define separate "server" blocks for<br>
ports 80 and 443, due to the complex nature of the hosting environment<br>
in which I'm working.<br>
<br>
Currently, all vhosts receive:<br>
<br>
server {<br>
listen *:80;<br>
<br>
listen *:443 ssl;<br>
}<br>
<br>
Without separating ports 80 and 443 into individual "server" blocks, I<br>
saw no way to avoid the loop without using an "if" structure.<br>
<br></blockquote><div><br><div class="gmail_default" style="font-size:small;color:rgb(51,51,153);display:inline">IMHO, that's the sorrect way of doing things. You could also listen for IPv6 requests :o)<br></div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Am I missing something?<br>
<br>
Thanks again,<br>
<br>
-Ben<br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a></blockquote></div><br><font size="1"><span style="color:rgb(102,102,102)">---<br></span><b><span style="color:rgb(102,102,102)">B. R.</span></b><span style="color:rgb(102,102,102)"></span></font>
</div></div>