Welcome! Log In Create A New Profile

Advanced

Re: Please help with proxy_pass and trailing slash!

March 15, 2012 12:08AM
Valentin V. Bartenev Wrote:
-------------------------------------------------------


> > location / {
> > # First attempt to serve request
> as file, then
> > # as directory, then fall back
> to index.html
> > try_files $uri $uri/
> /index.php?$args;
> > }
>
> Just a side note, you don't need explicit set
> $args here.
>
> try_files $uri $uri/ /index.php;
>
>
> > location ~ index.php$ {
> >
> > try_files $uri =404;
> >
> > include fastcgi_params;
> > fastcgi_index index.php;
> > fastcgi_param SCRIPT_FILENAME
> > $document_root$fastcgi_script_name;
> > fastcgi_pass 127.0.0.1:9000;
> > }
> > }
> >
> > with this configuration, Java server receives
> requests like "GET /app/"
> > while it should receive "GET /"
> >
> > If I add trailing slash to proxy_pass:
> >
> > proxy_pass http://localhost:9001/;
> >
> > Then java server receives "GET //" and unable
> to serve that either.
> >
> > Do I need to involve rewrite here ? And how? or
> extra trailing slash is
> > caused by other rewrite rules somehow?
> >
>
> Documentation already has answers to your
> questions:
> http://nginx.org/en/docs/http/ngx_http_proxy_modul
> e.html#proxy_pass
>
> E.g., in your case:
>
> location /app/ {
> ...
> proxy_pass http://localhost:9001/;
> }
>
> wbr, Valentin V. Bartenev
>

Thanks Valentin.

I get it now! I had
location /app {

and it should be
location /app/ {

with trailing slash. Weird that it's sensitive for that slash there.

Thanks.
Subject Author Posted

Please help with proxy_pass and trailing slash!

Roddick March 14, 2012 01:05PM

Re: Please help with proxy_pass and trailing slash!

Valentin V. Bartenev March 14, 2012 02:08PM

Re: Please help with proxy_pass and trailing slash!

Roddick March 15, 2012 12:08AM

Re: Please help with proxy_pass and trailing slash!

Edho Arief March 15, 2012 12:20AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 71
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready