I'm trying to use the proxy_pass
directive to proxy requests to different servers.
In the following conf, /api1
and api2
are proxied correctly but api3
is not.
The server api3.server3.com
runs an Apache server that proxies /api-alt
to the correct server (which I cannot contact via the nginx server)
server {
location /api1 {
proxy_pass https://api1.server1.com;
}
location /api2 {
proxy_pass https://api2.server2.com;
}
location /api3/ {
# This one breaks
# api3.server3.com can proxy/rewrites '/api-alt' to another server
proxy_pass https://api3.server3.com/api-alt;
}
}
myserver.com/api3/thing
returns a HTTP/400 (bad request)
I'd like to have this proxy_pass working but I'm stumped.