reverse proxy does not load webpage data

petrg nginx-forum at forum.nginx.org
Mon Feb 1 08:11:57 UTC 2021


Hey,

I am quite new with nginx. And so my problem might be more on a basic
level.
I am running a html website. This is not an official hosted one but more an
internal service webpage of some device. 
It is installed on a PC (PC-device) together with nginx, that supports all
the data needed for the webpage.
If I call the webpage from a connected PC (PC-browser) everything is working
fine.
But now I’d like to run a reverse-proxy (PC-proxy) in between. 
So the PC-browser does not see the PC-device anymore.
PC-device is linked to PC-proxy via 192.168.5.0.
PC-browser is linked to PC-proxy via 192.168.1.0.
When I call the webpage now the index.html will be loaded via the proxy-pass
configuration on the PC-proxy (also nginx), but all the next stuff like .js
files and image files are not.
I tested a lot but I am stuck.
This structure of a reverse proxy looks very basic for me. But I don’t get
it run.

My configuration:

PC-device
   /path/index.html
      <img src="/images/logo.jpg" …>

   nginx.conf
      location /images/
         absolute_image_path

PC-proxy
   nginx.conf
      location /device/
         proxy_pass 192.168.5.1/path
         index.html

PC-browser
   url: 192.168.1.1/device/index.html

=> index.html will be loaded correctly from PC-device, because of the
proxy-pass configuration
=> but the Logo-image, that will be loaded by the index.html, will not be
found.

So, how does a reverse-proxy load data for a webpage ?
How should nginx(PC-proxy) know, where to find the image-file
/images/logo.jpg that is asked for by the webpage ? 
Or is it necessary that all data of the webpage has to be relative to the
starting point “192.168.1.1/device/index.html” ?
I am not sure if my misunderstanding is related to the webpage structure or
to the reverse-proxy function.

Thanks for any help.

sorry, I posted this problem already on the german list, but got no answer.

As this english list seems more crowded, I'd like to give it a second try.

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



More information about the nginx mailing list