Thank you both for the insight.<br><br>-Jake<br><br><br><div class="gmail_quote">On Fri, Apr 11, 2008 at 11:04 AM, Igor Sysoev <<a href="mailto:is@rambler-co.ru">is@rambler-co.ru</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="Wj3C7c">On Wed, Apr 09, 2008 at 03:26:57PM -0400, J Davis wrote:<br>
<br>
> Greetings.<br>
><br>
> I want to redirect certain URL's to https. I've come up with a few ways that<br>
> I think will work but I'm wondering which method is more efficient in terms<br>
> of how much processing nginx would do.<br>
><br>
> 1st method: multiple 'location' sections.<br>
><br>
> location /sub1 {<br>
> rewrite ^(.*) https://$host$1 redirect;<br>
> }<br>
> location /sub2 {<br>
> rewrite ^(.*) https://$host/sub2 redirect;<br>
> }<br>
><br>
> 2nd method: one location w/ multiple redirects.<br>
><br>
> location / {<br>
> rewrite ^(/sub1.*) https://$host$1 redirect;<br>
> rewrite ^(/sub2.*) https://$host$1 redirect;<br>
> }<br>
><br>
> 3rd method: match using $scheme.<br>
><br>
> if ($scheme ~ http) {<br>
> rewrite ^(/sub1.*) https://$host$1 redirect;<br>
> rewrite ^(/sub2.*) https://$host$1 redirect;<br>
> }<br>
><br>
> My guess is that method 1 would be more efficient because rewrite processing<br>
> would only happen if the location matched.<br>
<br>
</div></div>1st method is the faster.<br>
As to matching $scheme: you have to create two virtual servers - http and https,<br>
so http server will always have "http" scheme.<br>
<font color="#888888"><br>
<br>
--<br>
Igor Sysoev<br>
<a href="http://sysoev.ru/en/" target="_blank">http://sysoev.ru/en/</a><br>
<br>
</font></blockquote></div><br>