I need to configure nginx, which is acting as reverse proxy for my site (myportal.com). nginx can connect to the actual site via squid proxy.
client -> nginx -> Squid Proxy -> web server.
Note:
a. Client assumes nginx as the web server (of myportal.com).
b. nginx fetches the content from actual server (myportal.com), via squid proxy.
Thanks Tarun. We have successfully configured nginx as reverse proxy when the destination web server is reachable directly. But while connect to the web serve behind squid. We are facing issue. As the Client has to connect to the nginx assuming it is the destination server (hence no proxy headers sent). –
We tried the following too.
upstream @squid {
server localhost:3128;
}
server {
listen 80;
server_name relay.example.com;
location / {
proxy_pass http://@squid/$scheme://$host$uri;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Request-URI $request_uri;
proxy_redirect off;
}
}
Give a try to this configuration, it is using Nginx as a reverse proxy and caching, probably could help you get an idea: