Hi,
I’m a noob.
How to rewrite http to https in /admin location only ?
I put something like this in nginx.conf :
location /admin {
rewrite ^(.*) https://$server_name$1 permanent;
}
But I always get error message “The page isn’t redirecting properly” in
Firefox when I browse http://$server_name/admin
Thanks.
Best regards
Gunawan
Using Opera’s revolutionary e-mail client: Opera Web Browser | Faster, Safer, Smarter | Opera
gunawan
2
On Sun, Dec 26, 2010 at 12:20 PM, gunawan [email protected] wrote:
}
But I always get error message “The page isn’t redirecting properly” in
Firefox when I browse http://$server_name/admin
…how about posting the full config file you’re using.
gunawan
3
Attached is the nginx.conf file, no separtion between server 80 and
server
443.
If I make separation between server 80 and server 443, it’s ok.
Thanks.
On Sun, 26 Dec 2010 17:23:37 +0800, Edho P Arief [email protected]
wrote:
rewrite ^(.*) https://$server_name$1 permanent;
nginx mailing list
[email protected]
nginx Info Page
–
Using Opera’s revolutionary e-mail client: Opera Web Browser | Faster, Safer, Smarter | Opera
gunawan
4
On Sun, Dec 26, 2010 at 5:13 PM, gunawan [email protected] wrote:
Attached is the nginx.conf file, no separtion between server 80 and server
443.
If I make separation between server 80 and server 443, it’s ok.
That’s the problem.
Also it’s recommended to make separate block for http and https.
Here’s what happens:
- access http://$server_name/admin
- matches /admin { } block, nginx redirects to
https://$server_name/admin
- matches /admin { } block, nginx redirects to
https://$server_name/admin
- repeat for infinity
Firefox sanely stops following redirection when it detects such loop.
tip: use
rewrite ^ https://$server_name$request_uri?$args permanent;
instead of
rewrite ^(.*) https://$server_name$1 permanent;
gunawan
5
Attached is the nginx.conf file, no separtion between server 80 and
server
443.
If I make separation between server 80 and server 443, it’s ok.
Thanks.
On Sun, 26 Dec 2010 17:23:37 +0800, Edho P Arief [email protected]
wrote:
rewrite ^(.*) https://$server_name$1 permanent;
nginx mailing list
[email protected]
nginx Info Page
–
Using Opera’s revolutionary e-mail client: Opera Web Browser | Faster, Safer, Smarter | Opera
gunawan
6
Ok, thanks.
On Sun, 26 Dec 2010 18:17:33 +0800, Edho P Arief [email protected]