在全站升级https后,突然发现某些接口暂时不能直接重定向。需要时间处理,所以需要在nginx中重定向所有URL中排除某个指定的URL
原始配置:
修改后:
原始配置:
server {
listen 80;
server_name www.abc.com abc.com;
if ($host != 'www.leftso.com' ){
rewrite ^(.*)$ http://www.abc.com$1 permanent;
}
HTTPS 301
rewrite ^(.*)$ https://www.abc.com$1 permanent;
}
修改后:
server {
listen 80;
server_name www.abc.com leftso.com;
if ($host != 'www.abc.com' ){
rewrite ^(.*)$ http://www.abc.com$1 permanent;
}
location /需要排除的URL地址 {
# 非默认端口需要添加$server_port
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#解决shiro跳转问题
proxy_pass http://localhost:8080;
}
location / {
#HTTPS 301
rewrite ^(.*)$ https://www.abc.com$1 permanent;
}
#HTTPS 301
#rewrite ^(.*)$ https://www.abc.com$1 permanent;
}
版权申明:本文为博主原创文章,未经博主允许不得转载。
https://www.leftso.com/blog/869.html
时效提示:本文最后更新于【 2021-11-22 13:45:38 】,某些文章具有时效性,若有错误或已失效,请在下方留言。
时效提示:本文最后更新于【 2021-11-22 13:45:38 】,某些文章具有时效性,若有错误或已失效,请在下方留言。
评论区域
评论功能已关闭. 提示:评论功能虽已关闭,关闭之前的评论仍然会展示。