Try something like this:

map $urlprefix $urlproxy {
  "foo" "https://foohost.foo.com";;
  "bar" "http://barhost.blah.com";;
  "fie" "https://fie.special.domain.com/blubb";;
  default "https://standard.com";;
}

[...] 

location ~ "^/(?<urlprefix>[^/]+)(?<urlsuffix>/.*)$" {

  [...]
  proxy_pass "$urlproxy$urlsuffix$is_args$args";
  [...]
}

You can dynamically determine the host (including a URL piece, if necessary)
with the "map", and use the mapped proxy prefix then in the proxy_pass
directive. If whatever lies beyond the NGINX requires URL arguments, don't
forget the $is_args$args part.

--j.

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

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Reply via email to