Reputation: 4907
I'm trying to use proxy_pass with nginx to mask redirects to my image CDN. I'd like to be able to go to a path like:
myserver.com/images/12345/whatever-name-goes-here.jpg
I'd like that to proxy to
i've tried the following
location ~ /images/(.*)/(.*) {
proxy_pass http://imagecdn.com/$1.jpg;
}
But i keep getting 502 errors. Any idea if this is even possible ?
Upvotes: 0
Views: 471
Reputation: 1107
I would suggest using an actual redirect, such as:
location ~ ^/images/(.*)/(.*)$ {
return 301 $scheme://imagecdn.com/$1.jpg;
}
Upvotes: 1