Rewrite non-ssl to ssl except for given location
Edho Arief
edho at myconan.net
Sun Apr 15 15:28:18 UTC 2012
2012/4/15 Adnan RIHAN <adnan at rihan.fr>:
> Hi everybody,
>
> I'm using an internal proxy for one of my websites (just a PHP script which
> does a curl request for a given script).
>
> I've forced every non-ssl location to ssl with this:
>
> rewrite ^/(.*) https://$host/$1 permanent;
>
>
> The thing is that my scripts doesn't need SSL as it's internal, so I want to
> force SSL except for a given location:
>
> location = /includes/api.php {
> }
> rewrite ^/(.*) https://$host/$1 permanent;
>
>
> Unfortunately, this isn't enough and queries to /includes/api.php?foo=bar
> still sends me a 301 redirect.
> Am I missing something ?
location / {
return 301 https://$host$request_uri;
}
location = /includes/api.php {
...
}
More information about the nginx
mailing list