3

Looking to implement an office network with peak # users of 40-50 people and clients and I'm thinking that nginx could be used as a transparent proxy to cache requests to any HTTP-based site at the edge of the network. Is this possible? And if so, how?

I have tried googling and searching but it seems that all resources seem to point at hosting your own servers and caching requests to those. However, we will also be hosting servers in this network, so nginx will be used to route requests to those as well.

So: how do I set up nginx as a transparent proxy for requests to internet servers, in a way that can also proxy calls to our web servers?

Henrik
  • 386
  • 2
  • 4
  • 13

4 Answers4

6

Actually you CAN use nginx as a transparent proxy

http://pastebin.com/BDt2fXxF

We are using nginx as proxy in my company since about 10 minutes and it's working perfect up to now (I'll see how to enable caching later).

Matias Moreno
  • 76
  • 1
  • 2
2

Squid would be a better choice listening on the normal port and redirecting by your favorite firewall.

Network ---> Firewall listening on port 80 forwarding to 3128 (Squid)

Crankyadmin
  • 332
  • 1
  • 5
2

You can't do this. Nginx is a reverse proxy, and what you a describing is a forward proxy. Squid or Polipo are examples of these (although Squid can also be used as a reverse proxy).

Martin
  • 109
  • 1
  • 2
  • 5
sciurus
  • 12,678
  • 2
  • 31
  • 49
  • You can use nginx as a forward proxy - but it is not as full-featured as something like Squid. – thomasrutter Jul 15 '14 at 04:45
  • I was surprised to hear that, but it looks like with some hacks you can use it as a forward proxy. Of course, like the first answer states you wouldn't actually want to. http://serverfault.com/questions/298392/nginx-as-http-proxy-server-not-reverse-proxy – sciurus Jul 16 '14 at 13:19
  • Its support for caching is poor, and it does not support proxying of HTTPS (ie, the CONNECT method). It supports just enough proxying features to make it useful as a reverse proxy, and the fact it works as a forward proxy at all is just a bonus. – thomasrutter Jul 16 '14 at 23:44
1

Apache Traffic Server can serve as both a forward- and reverse-proxy. You can listen to an interview with the project on FLOSS Weekly #179 (where they quickly dismiss Squid as being old and slow.)

Given the size of your environment, you probably don't need a hierarchal cache; you'll probably be fine with a single HTTP Proxy Cache.

Henrik
  • 386
  • 2
  • 4
  • 13
gWaldo
  • 11,957
  • 8
  • 42
  • 69