Welcome! Log In Create A New Profile

Advanced

Re: tell nginx to stay inside same location?

July 30, 2015 03:20PM
On 30 Jul 2015, at 17:57, Gregory Edigarov <edigarov@qarea.com> wrote:

> Hello,
>
> is that possible to tell nginx to stay inside the same location after rewrite rule is done?
>
> i.e. I have:
>
> location /njs/ {
> proxy_pass http://localhost:5501;
> ......
> }
>
> now, if i need to cut off /njs/ part, i added the following:
> location /njs/ {
> rewrite /njs(.*) $1;
> proxy_pass http://localhost:5501;
> ..........
> }
>
> but, that doesn't work, because my uri has changed and nginx goes to the default location, which I don't need.
>
> what could I do in this situation?

Just add slash in upstream:

location /njs/ {
proxy_pass http://localhost:5501/;
......
}


--
Igor Sysoev
http://nginx.com

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

tell nginx to stay inside same location?

Gregory Edigarov July 30, 2015 11:00AM

Re: tell nginx to stay inside same location?

Edho Arief July 30, 2015 11:04AM

Re: tell nginx to stay inside same location?

Gregory Edigarov July 30, 2015 11:42AM

Re: tell nginx to stay inside same location?

Igor Sysoev July 30, 2015 03:20PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 114
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