16

I am loading images from an external site which I want to use in a 3D WebGL canvas. However this is not allowed due to origin.

The URL I am generating from the web page is as follows:

http://domain/somename/imagesproxy?url=http%3A%2F%2Fanothersite%2Fimage.png

Now I want to proxy_pass I assume, to the URL included in the request.

location /somename/imagesproxy {
     proxy_pass  ...
     proxy_set_header  host localhost;
}

How do I get nginx to dynamically proxy to different URL's

sphvn
  • 265

2 Answers2

-1
location = / {
    if ($args ~ "^url=(.+)") { #gets the "url" get parameter
        set $key1 $1;
        proxy_pass $key1; #use the parameter as proxy address
    }
}
Sven
  • 100,763