I have the following API (s):
- localhost: 300 / api / customers /
- local: 400 / API / clients /: identifier / billing
- local: 500 / API / orders
I would like to use NGINX so that they all work in the following place:
local: 443 / API /
This seems very complicated because clients span two servers.
Here is my unsuccessful attempt starting with orders
server {
listen 443;
server_name localhost;
location /api/orders {
proxy_pass https://localhost:500/api/orders;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
}
}
server {
listen 443;
server_name localhost;
location /api/customers/$id/billing {
proxy_pass https://localhost:400/api/customers/$id/billing;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
}
}
server {
listen 443;
server_name localhost;
location /api/customers {
proxy_pass https://localhost:300/api/customers;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
}
}
Does something jump before the fix? Thank!
source
share