Welcome! Log In Create A New Profile

Advanced

Re: reverse proxy does not load webpage data

February 02, 2021 02:21AM
Hey Francis,

thanks a lot for your extensive answer.
Now I understand much better.
But let me discuss one misty point.

> There is no magic; it does what you configure it to do. The browser makes
> a request to nginx; nginx handles that according to its config. Every
> request is independent.
>
> > How should nginx(PC-proxy) know, where to find the image-file
> > /images/logo.jpg that is asked for by the webpage ?
>
> You need to configure your nginx to do what you want it to do.

My hope was that the proxy-pass directive creates not magic but some “context”, wraps the whole handling of the webpage into some linked “context”, so a bit more than just a straight location directive does. And so all the following requests from that webpage live in that “context”.
So when you define a proxy-pass to 192.168.5.1/path all the following requests from that webpage starting with 192.168.5.1/path/index.html should be directed to at least 192.168.5.1.

If every request is independent, you must know the internal structure of a webpage when you like to reverse-proxy it. Is that true ?
My feeling is that you should be able to reverse-proxy a webpage without knowing anything of the internal details, how data are loaded interenally.
So my hope was that the proxy directive wraps the webpage and all the internal requests and knows where to direct the related requests to.

> When the browser talks to PC-proxy and asks for
> http://192.168.1.1/device/index.html it gets the same html back,
> and it makes five new requests for
> http://192.168.1.1/device/one.jpg,
> http://192.168.1.1/path/two.jpg,
> ...

When I call 192.168.1.1/device/index.html I hoped that the following not absolute requests would be proxied to
http://192.168.5.1/path/one.jpg,
http://192.168.5.1/path/two.jpg, …
as the proxy knows that one.jpg belongs to http://192.168.1.1/device/index.html what is proxied to http://192.168.5.1/path/.
And so it can direct the internal request for one.jpg to http://192.168.5.1/path/one.jpg.

Is that a "slightly" wrong understanding of the proxy functionality ? and too much of magic ?
Subject Author Posted

reverse proxy does not load webpage data

petrg February 01, 2021 03:11AM

Re: reverse proxy does not load webpage data

Francis Daly February 01, 2021 05:54AM

Re: reverse proxy does not load webpage data

petrg February 02, 2021 02:21AM

Re: reverse proxy does not load webpage data

petrg February 02, 2021 02:24AM

Re: reverse proxy does not load webpage data

Francis Daly February 03, 2021 01:12PM

Re: reverse proxy does not load webpage data

petrg February 08, 2021 02:19AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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