Help: Using Nginx Reverse Proxy bypass traffic in to a application running in a container

Francis Daly francis at daoine.org
Wed May 19 08:27:30 UTC 2021


On Tue, May 18, 2021 at 07:29:20AM +0530, Amila Gunathilaka wrote:

Hi there,

I'm not entirely sure what your setup is, so I will describe what I
think you have; please correct me where I am wrong.

> I have nginx installed on my linux host and* listen on http port 80* and I
> want to bypass external traffic coming from external load balancer
> (up-stream server) into my *nginx reverse proxy server (80 port) *and want
> to bypass that http traffic into y application running in a docker
> container (application host port 9091),

I think you have "the client" (which is "the user with the web browser");
which makes a http request to "the external load balancer". That talks to
your nginx, which expects a proxy_protocol-then-http request. And nginx
makes a http request to "the container application", on 127.0.0.1:9091

> But my nginx configuration file didn't work as it always says *405 method
> not allowed* error when request passing from nginx into the external load
> balancer (up-stream server).

In nginx terms, in the setup I have described above, "upstream" is "the
container application", not the external load balancer. That won't affect
the problem, but might help searching the web for help.

So -- can you show an example request that does not give the response
that you want?

Some thing like

  curl -v http://load-balancer/whatever

will probably be helpful as a start. Feel free to remove any names or
addresses that you consider private, before pasting the response.

Right now, it is not clear to me if the 405 is coming from the load
balancer, from nginx, or from the container application. The fix will
likely be different in each case.

Possibly the logs from each of the servers will indicate how far things
get, and where they first fail. You might spot something obvious in there,
if you can easily find them.

Good luck with it,

	f
-- 
Francis Daly        francis at daoine.org


More information about the nginx mailing list