Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:


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

share|improve this question
From what I have read nginx is not designed to be a forward proxy however I would like to use an nginx solution if possible. – sphvn Jul 27 '12 at 13:04
location = / {
    if ($args ~ "^url=(.+)") { #gets the "url" get parameter
        set $key1 $1;
        proxy_pass $key1; #use the parameter as proxy address
share|improve this answer
This answer requires explanation. – kasperd Apr 8 at 10:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.