Rewrite non-ssl to ssl except for given location

Adnan RIHAN adnan at rihan.fr
Sun Apr 15 15:32:42 UTC 2012


> location / {
> return 301 https://$host$request_uri;
> }
> location = /includes/api.php {
> ...
> }
>  
>  

The problem is that I'm on a web hosting service which allow s customers to edit an included config file.
 So, "location /" is a duplicate :/

Isn't there a way to write "location [not matching] /includes/api.php {}" ?  

---
Cordialement, Adnan RIHAN.
Président-Fondateur de l'association (de loi 1901) Virtual-Info (http://www.virtual-info.info/), hébergeur Web et Serveurs de Jeux.
Consultant (http://rihan.fr/)-Technicien Supérieur en Informatique de Gestion.
Ambassadeur Qt (http://lyt.me/7E) (Projet Tag-PG (http://rihan.fr/fr/projets/tagpg)).


Le dimanche 15 avril 2012 à 17:28, Edho Arief a écrit :

> 2012/4/15 Adnan RIHAN <adnan at rihan.fr (mailto: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 {
> ...
> }
>  
> _______________________________________________
> nginx mailing list
> nginx at nginx.org (mailto:nginx at nginx.org)
> http://mailman.nginx.org/mailman/listinfo/nginx
>  
>  


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20120415/0be9b6af/attachment.html>


More information about the nginx mailing list