(本文档仅供参考)(nginx的方案源于网上资料,本文档仅供参考)
问题
因为需要通过Nginx进行代理转发,在Nginx配置文件中的如下,现在的问题是,通过Nginx转发可以访问到smartbi的登录页面,但是输入用户名和密码没有反映,进不了smartbi看不到资源,请问是什么问题呢?
代码块 | ||
---|---|---|
| ||
location /oa/test { proxy_pass http://192.168.1.10:8080/smartbi/vision/ ; proxy_connect_timeout 600s; proxy_send_timeout 600s; proxy_read_timeout 600s; } |
原因分析
登录不成功的原因是cookie_path与地址栏上的path不相符,服务器加载不到地址栏上path对应的cookie因此无法识别session的登录状态,结果就是服务器认为当前session是未登录状态因此停留在登录页或者在页面提示当前会话已经超时。
解决方案
基于问题中的Nginx配置,此Nginx参数配置目前有三个问题:
1、正常配置location的转发路径的时候,location /oa/test/ ,需要不能少一个斜杆:
2、不建议这样在映射后的路径中去掉vision ,因为这样重定向还会有问题,正常proxy_pass 配置到smartbi级别就行,具体如; 2、不建议proxy_pass配置到/vision级别 ,这样重定向会有问题,proxy_pass的地址只配置到/smartbi级别就行,具体如;
proxy_pass http://192.168.1.10:8080/smartbi/ ;
...
代码块 | ||
---|---|---|
| ||
location /oa/test/ {
proxy_pass http://192.168.1.10:8080/smartbi/ ;
proxy_connect_timeout 600s;
proxy_send_timeout 600s;
proxy_read_timeout 600s;
proxy_redirect http://$host/smartbi /oa/test;
proxy_cookie_path /smartbi /oa/test;
}
|
...