Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Re: nginx proxy to external proxy

$
0
0
I had got a solution to my issue.
What I wanted to setup was an nginx reverse proxy, so that:
- it will receive requests from the client
- replace the host part in that URL with another CDN I wanted to access
- forward this request to the CDN, through a forward proxy.

I had to access the CDN through the nginx server, because I wanted to cache the contents served, and thus reduce the number of hits to CDN.

Well, the solution I got is this:

myconfig.conf

server {
listen 8000;
server_name my-domain-name.com;

location / {

rewrite ^(.*)$ "://the-cdn-domain-name.com$1";
rewrite ^(.*)$ "https$1" break;
proxy_pass http://X.X.X.X:1234; # this is my forward proxy IP
}
}

This is what you have to include in the conf.d directory.

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>