末尾不带 /
当末尾不带 / 的情况,保留原始路径。
如下:
location /api/ {
proxy_pass http://localhost:8080
}
当访问 /api/user 接口时,会转发到 http://localhost:8080/api/user。
末尾带 /
当末尾带 / 的情况,替换原始路径。
如下:
location /api/ {
proxy_pass http://localhost:8080/
}
当访问 /api/user 接口时,会转发到 http://localhost:8080/user。