proxy_pass destination set by request custom header

masterkain nginx-forum at nginx.us
Thu Jun 21 17:06:42 UTC 2012


Hello,

  location ~ ^/api/v(\d)/foo/bar/(.*) {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect   off;
    proxy_max_temp_file_size 0;
    proxy_pass
http://$http_x_destination_host:$http_x_destination_port/$uri;
  }

What I'm looking for is to have X-Destination-Host and
X-Destination-Port contaning the exact host where to proxy_pass.
Since currently it doesn't seem to get picked up I would like to ask if
is this appear correct (not counting security implications).

Thanks.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,227781,227781#msg-227781



More information about the nginx mailing list