I am using Spring Protection and the Apache proxy for the web application. When using the standard mod_proxy, everything is fine, but after switching to AJP proxies, there is a problem with spring security redirection.
Apache configuration:
<VirtualHost *:80> ServerName domain.com ProxyPass / ajp://localhost:8009/Context/ ProxyPassReverse / ajp://localhost:8009/Context/ </VirtualHost>
When I call http://domain.com/login , I see the login form.
When I submit the form, I go to http://domain.com/auth and get authentication.
Then Spring Security should be redirected to http://domain.com/index , but instead redirected to http://domain.com/Context/index
How can I get rid of this path? Why does Spring Security add it everywhere?
There was a similar question on the Spring Security site, but no one answered:
http://forum.springsource.org/showthread.php?95141-Why-is-spring-security-including-the-context-path
PS It seems strange that Google does not find anything more related to this problem. Am I the only one using Spring Security + AJP? Maybe this is the wrong template?
Decision:
<VirtualHost *:80> ServerName domain.com RewriteEngine on RewriteRule ^/Context/(.*)$ /$1 [R=301] ProxyPass / ajp://localhost:8009/Context/ ProxyPassReverse / ajp://localhost:8009/Context/ </VirtualHost>
source share