我已将 nginx 配置为我们的 hudson 构建服务器的反向代理,如下所示:
server {
listen 80;
server_name koala.proxy.internal;
location /hudson/ {
proxy_pass http://build.example.com/hudson/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header Host $http_host;
proxy_redirect off;
}
后端 hudson 服务器配置为使用 hudson active directory 插件通过 Active Directory 对用户进行身份验证。
一切正常,除了当我单击注销按钮时,什么也没有发生,我仍然登录,而预期的行为是,我应该被注销并返回到登录页面。
Firebug 中的请求和响应标头显示以下内容:响应:
HTTP/1.1 302 Moved Temporarily
Server: nginx
Date: Wed, 01 Sep 2010 02:40:57 GMT
Connection: keep-alive
Set-Cookie: ACEGI_SECURITY_HASHED_REMEMBER_ME_COOKIE=""; Path=/hudson
Location: http://koala.proxy.internal/hudson/
Content-Length: 0
Expires: Thu, 02 Sep 2010 02:40:57 GMT
Cache-Control: max-age=86400
要求:
GET /hudson/logout HTTP/1.1
Host: koala.proxy.internal
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: http://koala.proxy.internal/hudson/people/
Cookie: screenResolution=1280x720; JSESSIONID=8957FA425BC89DE784266DAACAD45135
当我直接访问 Hudson 服务器并单击注销按钮时,以下是来自该服务器的标头:
回复:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Expires: 0
Content-Type: text/html;charset=UTF-8
Transfer-Encoding: chunked
Date: Wed, 01 Sep 2010 05:00:33 GMT
要求:
GET /hudson/login?from=%2Fhudson%2F HTTP/1.1
Host: build.example.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: http://build.example.com/hudson/
Cookie: screenResolution=1280x720; JSESSIONID=105C0A7031B817E0321336310FC8D6E1
据我从标题理解,当我单击注销时,GET 请求应该是 for"/hudson/login?from=%2Fhudson%2F"
而不是 for "/hudson/logout"
,就像通过反向代理发生的那样。
我尝试了很多方法让它工作,但都无济于事。如果有人能指导我,我将不胜感激。
谢谢,Mogaroy
答案1
对于可能面临类似问题的任何人,我通过添加“add_header Pragma“无缓存”'到我的配置。
http://agiletesting.blogspot.com/2010/06/commong-nginx-configuration-options.html
谢谢,Mogaroy