This week's giveaway is in the JDBC forum.
We're giving away four copies of Java Database Connections & Transactions (e-book only) and have Marco Behler on-line!
See this thread for details.
Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Struts redirect behind reverse proxy  RSS feed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an issue dealing with a struts application behind an apache proxy.

The url used through proxy is https://www.example.com/myapp/.
The proxy redirects to http://localmachine:8080/myapp/Logon.do.
So when the struts application redirects to new pages, the new pages fail to load.

Proxy config contains:
RewriteRule /myapp/(*.)  http://localmachine:8080/myapp/$1 [P,L]

The myapp/WEB-INF/web.xml contains:
<welcome-file-list>
   <welcom-file>index.jsp</welcome-file>
</welcom-file-list>

The myapp/WEB-INF/struts-config.xml contains:
<global-forwards>
   <forward name="Welcome" path="/Logon.do" >
</global-forwards>

The myapp/index.jsp contains:
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<logic:redirect forward="Welcome"/>

Could anyone tell me how to make this struts application work properly behind the reverse proxy?
 
Bartender
Posts: 9559
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is your local web server?  If it is Tomcat, do you have your Connector(s) configured with a proxyName/proxyPort like this:



see here for more info
 
Michelle Griffin
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, I did not get to test this sooner, the system was dismantled and rebuilt but now I am able to test your solution below.

I added the proxyName and proxyPort to the Tomcat conf/server.xml file but it seemed to have no affect.

Is there maybe another configuration setting I am missing?  Or another area I should try to debug?

Thank you again for the assistance.
 
Bartender
Posts: 20766
124
Android Eclipse IDE Java Linux Redhat Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think you're actually using an Apache reverse proxy in the strict sense. I think you're just rewriting URLs.

Apache has 2 reverse proxy modules that can work with Tomcat: mod_jk and mod_proxy. You didn't supply the directives that would have made either of them do the proxying.

A true reverse proxy does more than just rewrite URLs. In fact, the Apache proxies forward the proxy requests over special channels using special protocols, so instead of talking to Tomcat port 8080 or 8443, they talk to port 8081, which is the Coyote Connector for proxy traffic.

And, incidentally. using an application-supplied login instead of letting Tomcat handle login via J2EE security is a lot less secure.
 
Crusading Chameleon likes the size of this ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!