Greetings.<br><br>I want to redirect certain URL's to https. I've come up with a few ways that I think will work but I'm wondering which method is more efficient in terms 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 would only happen if the location matched.<br><br>Thanks,<br>-Jake<br>