Page 1 of 1

login link gets redirected

Posted: Sun Apr 20, 2014 9:21 am
by prabhat.kataria
I have configured Broadleaf demo site to run with tomcat server directly from eclipse not by using ant task. I tried to visit login, register and cart page but the link got redirected. Since in demosite for tomcat login page must be at /mycompany/login when i click on login link i get redirected to /mycompany/mycompany/login.

I tried to directly hit the link http://localhost:8181/mycompany/login but it also gets redirected/changed to http://localhost:8181/mycompany/mycompany/login. This same issue repeats on clicking register and cart link.

In logs i can see "No mapping found for HTTP request with URI [/mycompany/mycompany/login] in DispatcherServlet with name 'mycompany'".

In LoginController i can see request mapping as "@RequestMapping("/mycompany/login")".

Any pointer to where i can look for error.

Re: login link gets redirected

Posted: Tue Apr 22, 2014 12:19 pm
by phillipuniverse
The redirect is happening because it is redirecting you to an https URL. See applicationContext-security:

Code: Select all

<sec:intercept-url pattern="/register*" requires-channel="https" />
<sec:intercept-url pattern="/login*/**" requires-channel="https" />
<sec:intercept-url pattern="/account/**" access="ROLE_USER" requires-channel="https" />
<sec:intercept-url pattern="/checkout/**" requires-channel="https" />
<sec:intercept-url pattern="/confirmation/**" requires-channel="https" />


If you are deploying on Tomcat you will either need to setup an SSL connector on Tomcat and configure it appropriately or remove the 'requires-channel' attributes from the above configuration in applicationContext-security.xml

Re: login link gets redirected

Posted: Wed Apr 23, 2014 12:41 am
by prabhat.kataria
Voila!!! Thanks for the information. I got it working by removing requires-channel attribute. Will try configuring SSL Connector on tomcat as this is something new to me. Also not sure whether i would be allowed to configure SSL connector on web hosting server like mochahost !!!