Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have developed a login authentication page using cookies (with spring security) where for the first time, the user will need to get itself authenticated. Once the user gets successfully authenticated, then on each subsequent request from the same browser, the user will redirected to the success page. The code is working fine on

localhost:8080 

but the problem is I have configured Apache HTTP server and when I hit the request through the Apache server to the application, then I think the cookies are not been read by the Apache server.

I have enabled the cookies in httpd.conf file (but it is not working) as well by

LoadModule usertrack_module modules/mod_usertrack.so

and

<VirtualHost *>
    ServerName localhost
    CookieTracking on
    ProxyPass / http://localhost:8080/stackoverflow/
</VirtualHost>

Please let me know what am I doing wrong

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Your server on localhost is most likely writing the cookies for localhost, or for the stackoverflow directory. When it is accessed from behind a reverse proxy, it needs to recognize this and set the cookies the correct domain name.

Instead of the smarts for this residing in the web app on port 8080, you could have the reverse proxy translate the cookies:

ProxyPassReverseCookiePath /stackoverflow /
ProxyPassReverseCookieDomain localhost example.com

See this question on StackOverflow where I asked about jsessionid cookies and used this technique on the reverse proxy to solve my problem.

share|improve this answer
    
I have added ProxyPassReverseCookiePath in httpd.conf but it is giving me "invalid command" error on console. Which LoadModule do it need for this. I already have mod_proxy uncommented in the httpd.conf file –  bhuvan Mar 19 '13 at 3:54
    
I think I need to use Apache 2.2 if I need to use ProxyPassReverseCookiePath. Isn't it? –  bhuvan Mar 19 '13 at 4:38
    
Its working now.. Thanks Stephen so much.. I don't have enough reputations to give an up-vote here but will be giving it to you on your question in Stackoverflow. Thanks again –  bhuvan Mar 19 '13 at 5:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.