Nginx rewrite issue

OS_Killer nginx-forum at forum.nginx.org
Sun Feb 20 19:40:05 UTC 2022


Arguments from the requests are not taken into account when nginx choosing
locations.
Try to use the 'map' directive instead.
For example:
=======
map $arg_target $backend {
 'server1' 'server1';
 'server2' 'server2';
  default  'server1';
}

server {
 listen 80;
  location = /index.html {
   proxy_pass http://$backend;
  }
}
=======
https://nginx.org/en/docs/http/ngx_http_map_module.html#map
https://nginx.org/en/docs/http/ngx_http_core_module.html#var_arg_

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,293708,293710#msg-293710



More information about the nginx mailing list