1

I'm trying to set up nginx as a cache proxy that can cache/serve pages only from one IP range (example: 31.29.100.0/24).

To set up the proxy I use this conf:

server {
    listen 8080;
    location / {
        resolver 127.0.0.1;
        proxy_pass $scheme://$http_host$uri$is_args$args;
        proxy_set_header X-Remote-Addr $proxy_add_x_forwarded_for;
    }
}

Now, this will serve as an open proxy, any destination client requires... Is there a way to limit the destination IPs?

Jakov Sosic
  • 5,267
  • 4
  • 24
  • 35
  • [Deny and allow](https://support.hypernode.com/knowledgebase/blocking-allowing-ip-addresses-in-nginx/). I don't see any caching set up there, just a proxy pass. – Tim Jul 15 '18 at 20:05
  • I don't need to block the client addresses, but the destination addresses. This can be done quite easily with Squid and `dst` acl. – Jakov Sosic Jul 15 '18 at 22:22
  • 1
    Nginx isn't design to do this. Use Squid. – Tim Jul 15 '18 at 22:35

0 Answers0