0

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?

Сергей
  • 101
  • 1

1 Answers1

0

Ok, I added this

resolver 172.6.16.16 [::1]; in location section and it works.

Сергей
  • 101
  • 1