Reputation: 117
i have this NGINX location in my default.conf
location /api-gateway/ {
proxy_http_version 1.1;
proxy_connect_timeout 75s;
proxy_read_timeout 100s;
client_max_body_size 100m;
proxy_set_header Host test.domain.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
proxy_buffers 16 8k;
proxy_buffer_size 4k;
proxy_max_temp_file_size 0;
rewrite ^/api-gateway/(.*)$ $1 break;
proxy_pass http://ingress-srv; # ingress-srv is an upstream
}
here is an example of the request that is coming to my NGINX server: http://demo.domain.com/api-gateway/service/v1/metrics
i need to do the below
/api-gateway/
from the original url and then,ingress-srv
upstream without
changing the URL (no redirect)demo.domain.com
to test.domain.com
which i believe i have done it correctlyi can not make it work ..
Upvotes: 1
Views: 7094
Reputation: 5847
Instead of
proxy_pass http://ingress-srv; # ingress-srv is an upstream
try doing (notice the slash):
proxy_pass http://ingress-srv/; # ingress-srv is an upstream
You can take out the rewrite
directive.
As Oscar Wilde said "I was working on nginx.conf all the morning, and took out a comma. In the afternoon I put it back again."
Upvotes: 5