map

Map client header to upstream in nginx

Sometimes you want to route traffic to different endpoints based on a http header. Avoiding if statements in the nginx config is the most important part here. The example below is based on the user-agent header that is send from the client. Test nginx conf to view traffic flow # create upstreams # android and other non ios device upstream android { server 127.0.0.1:8080; } # ios based devices upstream ios { server 127.