i have the following nginx configs to redirect the url path to it's perspective services
server {
listen 80;
server_name abc.com;
location = favicon.ico { access_log off; log_not_found off }
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cache_bypass $http_upgrade;
location /a-ms/ {
rewrite /a-ms/(.*) /$1 break;
proxy_pass http:host.docker.internal:3000/;
}
location /b-ms/ {
rewrite /b-ms/(.*) /$1 break;
proxy_pass http:host.docker.internal:4000/;
}
}
the backend microservices using nodejs to host the api and swagger doc
When i got to a url from a browser like abc.com/a-ms/doc/
it return the swagger normal, but when i go to url without slash for example abc.com/a-ms/doc
it redirected me to abc.com/doc
which is not what i wanted(it missing the location path)(. How do i fix this with nginx config settings?