I have Nginx config as below:
upstream staging { server myappstaging.somedomain.com;}upstream prod { server myapp.somedomain.com:443;}# map to different upstream backends based on headermap $http_x_server_select $pool { default "prod"; staging "staging";}server { listen 80; server_name myapp.mydomain.com; location / { proxy_pass https://$pool; }}
I want to forward requests with x-server-select
header set to staging to http://myappstaging.somedomain.com
and for prod to https://myapp.somedomain.com:443
Is it possible do that with Nginx ?