DEV Community

Cover image for Nginx forward proxy - as Docker image
Robert Reiz
Robert Reiz

Posted on

Nginx forward proxy - as Docker image

Nginx is a very fast HTTP and reverse proxy server. Usually, Nginx is used to serve and cache static assets or as proxy or load balancer for incoming traffic to application servers. But it can be used as forward proxy as well.

Assume you have a network where you want to control outgoing traffic. You either want to:

  • Deny all outgoing calls by default and only allow HTTP(S) calls to whitelisted URLs.
  • Allow all outgoing calls by default and only block HTTP(S) calls to blacklisted URLs.

The Docker daemon can be configured that way that it routes all traffic through a proxy. This proxy can be an Nginx which is configured as forward proxy.

I have a build a Docker image which contains Nginx preconfigured as forward proxy. Check out the full notes and Docker at this GitHub repo.

Discussion (0)