samedi 28 février 2015

Apache with Proxypass and Spring Security

I am having a Spring MVC app which uses Spring Security for login. I am using Apache Webserver as Proxy and Tomcat. Below is my /etc/apache2/sites-enabled/example.com.conf file:



ServerAdmin admin@example.com
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/http://ift.tt/18GT7ew

ProxyPreserveHost On
ProxyRequests off

ProxyPass /myapp/j_spring_security_check http://localhost:8080/myapp/j_spring_security_check
ProxyPassReverse /myapp/j_spring_security_check http://localhost:8080/myapp/j_spring_security_check
ProxyPass /myapp http://localhost:8080/myapp
ProxyPassReverse /myapp http://localhost:8080/myapp


This works fine and I am able to log into my site. However, I have to use http://ift.tt/x8TEmW instead of http://example.com. If I use later, it shows me:



Index of /

[ICO] Name Last modified Size Description
[IMG] favicon.ico 2015-02-23 14:15 7.6K


If I modify the example.com.conf file as suggested by other sites/posts, I get nothing and http://example.com takes me to http://ift.tt/x8TEmW:



ProxyPass /j_spring_security_check http://localhost:8080/j_spring_security_check
ProxyPassReverse /j_spring_security_check http://localhost:8080/j_spring_security_check
ProxyPass / http://localhost:8080/myapp
ProxyPassReverse / http://localhost:8080/myapp


Can some one please help? Thanks.


Edit:


Below is my ROOT.xml in "~/apache-tomcat-7.0.52/conf/Catalina/localhost" folder which I created as per HOWTO set the context path of a web application in Tomcat 7.0.



<Context
docBase="/home/anuj/webapps/prod-prop-3"
path=""
reloadable="true"
/>


But when I tried this, http://example.com took me to http://ift.tt/1dQYKGD and gave error:



The requested URL /login was not found on this server.



What is the issue here, can someone help please?


Aucun commentaire:

Enregistrer un commentaire