nginx proxy pass only works for root location

gunitinug nginx-forum at forum.nginx.org
Thu Nov 18 22:31:27 UTC 2021


Maxim Dounin Wrote:
-------------------------------------------------------
> 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 at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

Loading of the app in browser fails. 

I checked the console and it says:

Loading failed for the <script> with source
“http://my_vps_public_ip/static/js/bundle.js”.
Loading failed for the <script> with source
“http://my_vps_ip_public_ip/static/js/0.chunk.js”. ecapp:30:1
Loading failed for the <script> with source
“http://my_vps_ip_public_ip/static/js/main.chunk.js”. ecapp:30:1

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,292884,292888#msg-292888



More information about the nginx mailing list