Basically, I am trying to use the proxy_pass
directive to call a remote API.
So far, this is what I got:
server {
location /a {
proxy_pass https://a.com;
rewrite ^/a(.*)$ $1 break; # no trailing slash, defined in application code
}
location /b {
proxy_pass https://b.com;
rewrite ^/b(.*)$ $1 break; # no trailing slash, defined in application code
}
location / {
# Rest of configuration
}
}
I am stuck with the fact that location /a
works fine but location /b
doesn't for some reason (HTTP/404
).
I tried using a trailing slash for location /b
this way
location /b/ {
proxy_pass https://b.com/;
rewrite ^/b/(.*)$ $1 break;
}
but this doesn't work either.
Any help is very welcome.