Welcome! Log In Create A New Profile

Advanced

Re: nginx proxy pass only works for root location

Maxim Dounin
November 18, 2021 08:38AM
Hello!

On Thu, Nov 18, 2021 at 05:51:08AM -0500, gunitinug wrote:

> Hello. I posted a question:
>
> https://unix.stackexchange.com/questions/678060/nginx-proxy-pass-only-works-for-root-location

First of all you may want to define "won't work". What exactly
happens, what goes wrong?

Note that in general there are no problems with proxying in nginx:
it will happily get a request from the client and pass it the
backend server, and will return the response from the backend
server to the client.

But proxying, especially if you are trying to proxy with changed
URI, might result in incorrect resulting page if your backend
server uses absolute links in responses. Or your backend server
might not like the request coming from nginx and will try to
redirect the client.

Most common issue which happens when proxying is wrong URLs in
redirections returned by the backend server. This is something
nginx is usually able to fix itself with the default settings of
the proxy_redirect directive. In complex cases some adjustment
might be needed though (see http://nginx.org/r/proxy_redirect for
details).

Another common issue is wrong links in the HTML pages
returned. In some cases these can be fixed with sub_filter
(http://nginx.org/r/sub_filter), but usually a better idea is to
configure your backend server to return correct links instead.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

nginx proxy pass only works for root location

gunitinug November 18, 2021 05:51AM

Re: nginx proxy pass only works for root location

Maxim Dounin November 18, 2021 08:38AM

Re: nginx proxy pass only works for root location

gunitinug November 18, 2021 05:31PM

Re: nginx proxy pass only works for root location

Maxim Dounin November 18, 2021 08:40PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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