nginx反代配置tips
nginx轮训导致验证码不正确
在upstream里添加ip_hash;
,例子:
http {
upstream test {
# 这样同一台电脑会一直访问到同一台机器
ip_hash;
server 172.0.0.1:8080;
}
}
静态资源访问出错
在location里重写header:
server {
location / {
index index.html index.htm;
proxy_pass http://test;
# 重写header
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;
}
}
To be continued...
本文作者:编程随写
本文链接:https://www.cnblogs.com/code-blog/p/17565936.html
版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
2022-07-19 Spring Data Jpa 分表处理