nGinx未将请求的URI传递给代理传递服务器
localhost/api/users上的请求工作正常,它正在访问代理服务器http://server1-srv/3000/在/路线nGinx未将请求的URI传递给代理传递服务器,nginx,docker-compose,nginx-reverse-proxy,nginx-config,nginx-location,Nginx,Docker Compose,Nginx Reverse Proxy,Nginx Config,Nginx Location,localhost/api/users上的请求工作正常,它正在访问代理服务器http://server1-srv/3000/在/路线 但是像localhost/api/users/clearcookie这样的请求没有命中proxy\u-pass服务器http://server1-srv:3000/在/clearcookie路线 我想要的是:- 对于所有请求,如localhost/api/users、locahost/api/users/clearcookie、localhost/api/u
- 但是像localhost/api/users/clearcookie这样的请求没有命中proxy\u-pass服务器http://server1-srv:3000/在/clearcookie路线
- 对于所有请求,如localhost/api/users、locahost/api/users/clearcookie、localhost/api/users/someotherroute等
- 一切都会变成这样http://server1-srv:3000, http://server1-srv:3000/clearcookie, http://server1-srv:3000/someotherroute 分别
- 而且不像http://server1-srv:3000/api/users 或http://server1-srv:3000/api/users/clearcookie
位置/api/users
块中,尝试添加:重写^/api/users/?(.*)$/$1中断代码>
server {
listen 80;
root /app;
location / {
index index.html;
}
location /api/users {
proxy_pass http://server1-srv:3000/;
proxy_set_header X-Forwarded-For $remote_addr;
}
location /api/chats {
proxy_pass http://server1-srv:4000/;
proxy_set_header X-Forwarded-For $remote_addr;
}
}