I want to create a mapping on nginx between $http_MyHeaderName and $port. I have much local hosted IIS sites and depending on header value nginx has to send request to one of them.
Config:
map $http_MyHeaderName $port {
Value1 4115;
Value2 4116;
}
server {
listen 80;
#listen 443;
server_name localhost;
location / {
proxy_pass http://localhost:$port;
}
Unfortunatelly I get 502 Bad gateway error and have no idea why?