大佬们,关于nginx配置:所有请求url为:/api/xxx (以/api开头为判断依据),均转发到 http:target.com/xxx(去掉/api)(请注意,并不是这样:http:target.com/api/xxx)这个逻辑咋实现。。我现在是这么做的 location ^~ /api { proxy_pass http://target.com; proxy_redirect off; proxy_set_header HOST $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; client_max_body_size 10m; client_body_buffer_size 128k; proxy_connect_timeout 90; proxy_send_timeout 90; proxy_read_timeout 90; proxy_buffer_size 4k; proxy_buffers 4 32k; proxy_busy_buffers_size 64k; proxy_temp_file_write_size 64k;
}但肯定不行,/api 也带过去了。。搜半天没搜到解决方案。。求大佬指点~
1 回答
- 1 回答
- 0 关注
- 650 浏览
添加回答
举报
0/150
提交
取消