Welcome! Log In Create A New Profile

Advanced

Re: Strip Character from Server Variable

Valentin V. Bartenev
February 29, 2012 09:58AM
On Wednesday 29 February 2012 18:52:40 Valentin V. Bartenev wrote:
> On Wednesday 29 February 2012 18:38:14 jamessinton wrote:
> > Hi all,
> >
> > I am trying to do something that sounds very simple and yet has me
> > perplexed. I need to strip the leading / from the $uri variable in my
> > nginx.conf. I need to then pass that modified variable to ProxyPass.
> >
> > I can't for the life of me figure out how to this in the nginx.conf
> > syntax.
> >
> > Thanks in advance.
>
> map $uri $uri_stripped {
> default $uri;
> ~^/(?P<s>.*)$ $s;
> }
>
> http://wiki.nginx.org/HttpMapModule
>
> or
>
> if ($uri ~ "^/(.*)$") {
> set $uri_stripped $1;
> }
>
> http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#if
> http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#set
>

or, maybe you just want this:

location ~ ^/(.*)$ {
...
fastcgi_param SOME $1; # just for example
}


wbr, Valentin V. Bartenev

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Strip Character from Server Variable

jamessinton February 29, 2012 09:38AM

Re: Strip Character from Server Variable

Valentin V. Bartenev February 29, 2012 09:54AM

Re: Strip Character from Server Variable

Valentin V. Bartenev February 29, 2012 09:58AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 270
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready