Reverse Proxy - Backend via Forward Proxy

Francis Daly francis at daoine.org
Wed Sep 1 22:18:00 UTC 2021


On Wed, Sep 01, 2021 at 04:16:59PM -0400, temp pmet wrote:

Hi there,

> we now have requirements to forward the backend connection to the
> destination via a forward proxy.  Is this possible?  The flow looks like
> this:
> 
> Client to -> NGINX reverse proxy server to -> backend server via forward
> proxy

When (stock) nginx is a client talking to a backend server, it can talk
http; it can't be configured to talk proxied-http. So if you need a proxy
server that only listens to proxied-http, you probably want something
other than nginx as the client.

However...

if your proxy server can be configured as "transparent" -- which basically
means that it will listen to http and interpret what it probably would
have been if it had been proxied-http -- then you should be able to tell
nginx that the proxy server *is* the backend server, and maybe it will
work well enough in your use case.

If that is worth testing, you can use an "upstream" block with the name
of the backend server, containing a "server" directive with the ip:port
of the proxy. (Or have the system resolver resolve the backend name to
the proxy ip, if special ports are not needed.)

(If your backend is https not http, then things are different again.)

Good luck with it!

	f
-- 
Francis Daly        francis at daoine.org


More information about the nginx mailing list