Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Daniel Butts
Login redirection problem with Apache and Tomcat
January 3, 2012 4:20 PM
Answer

Daniel Butts

Rank: New Member

Posts: 1

Join Date: January 3, 2012

Recent Posts

We are using apache and mod_jk to redirect requests on port 80 to Tomcat on port 8080. In order to ensure security, my portlet checks that there is an authenticated user and if there is not, it redirects to the login page. Here is the code that I use in the jsp of my portlet:

<%
if (request.getRemoteUser() == null) {
%>
<script type="text/javascript">
location.replace('/c/portal/login');
</script>
<%
} else {
%>

This redirects to the login page fine and when on the local machine, authentication works normally. However when browsing to Liferay from the Internet (http://myserver.mydomain.com/web/guest/home) the form target of the login page and the URL of the "Return to Full Page" link are http://localhost:8080/web/guest/home.

Liferay appears to be using the absolute url of where it is hosted in Tomcat rather than a relative url. Where have we gone wrong?

Thanks
Ravi Kumar Gupta
RE: Login redirection problem with Apache and Tomcat
January 3, 2012 9:03 PM
Answer

Ravi Kumar Gupta

Rank: Liferay Legend

Posts: 1137

Join Date: June 23, 2009

Recent Posts

I faced this problem.. See this post http://www.liferay.com/community/forums/-/message_boards/message/6895116

Let me know if this solves your problem..