I have configured nginx as a reverse proxy to our hudson build server as follows:
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; }
The backend hudson server is configured to authenticate users with Active Directory using
the hudson active directory plugin.Everything works fine, except that when I click the logout button, nothing happens, and
I am still logged in, wheras the expected behaviour is, I should be logged out and taken
back to the login page.The request and response headers in firebug show these:
Response: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
Request:
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
Below are the headers from the hudson server, when I access it directly and click the logout button:
Response:
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
Request:
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
As I understand from the headers,when I click logout, the GET request should be for
"/hudson/login?from=%2Fhudson%2F"
and not for"/hudson/logout"
, as is happening through the reverse proxy.I have tried many things to get it working but to no avail.Would really appreciate if someone could guide me here.
Thanks,
Mogaroy
Answer
For anyone who may be facing similar issues, I solved my problem by adding ‘add_header Pragma “no-cache”‘ to my configuration.
http://agiletesting.blogspot.com/2010/06/commong-nginx-configuration-options.html
Thanks,
Mogaroy
Attribution
Source : Link , Question Author : Nagaraj , Answer Author : Nagaraj