springboot之context-path
context-path是应用的上下文,所有该应用下web层的url地址都需要添加上下文,另外配置context-path对于使用nginx分发请求也很有帮助
upstream task{
server 100.100.88.152:8097;
check interval=30000 rise=2 fall=3 timeout=1000 type=http;
check_http_send "GET /market/task/turnTask HTTP/1.0\r\n\r\n";
check_http_expect_alive http_2xx http_3xx;
}
server {
location /market/task/ {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://task;
}
}
实现的功能是所有的请求中如果url中包含/market/task/的请求,都被分发到server 100.100.88.152:8097,这个ip和端口的服务器上。