标签:lis http strategy host path 跳转 单点登录 cat 代理
server {
listen 80; //监听的本地端口
server_name localhost;
location /api1/ {
proxy_pass http://localhost:8080;
}
# http://localhost/api1/xxx -> http://localhost:8080/api1/xxx;
location /api2/ {
proxy_pass http://localhost:8080/;
}
# http://localhost/api2/xxx -> http://localhost:8080/xxx;
location /api3 {
proxy_pass http://localhost:8080;
}
# http://localhost/api3/xxx -> http://localhost:8080/api3/xxx;
location /api4 {
proxy_pass http://localhost:8080/;
}
# http://localhost/api4/xxx -> http://localhost:8080//xxx;
# 请注意这里的双斜线,好好分析一下
location /api5/ {
proxy_pass http://localhost:8080/haha;
}
# http://localhost/api5/xxx -> http://localhost:8080/api4/hahaxxx;
# 请注意这里的haha和xxx之间没有斜杠
}
常用于cas单点登录跳转
unstream 10api {
server 192.168.1.10:8080;
}
server{
location ^~ /prod-api/ {
proxy_cookie_domain 10api $host;
proxy_cookie_path /strategy /prod-api;
#注意这里的路径 是两个不同的路径,中间有空格,把前者路径的cookie设定到后者
}
}
标签:lis http strategy host path 跳转 单点登录 cat 代理
原文地址:https://www.cnblogs.com/YangGC/p/12219099.html