Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

proxypass and deployment to a production env

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've been developing a struts app locally on my machine, accessing it directly through tomcat on port 8080:

http://localhost:8080/MyAppName/


The time has come to think about deploying it to production webserver now, and I was hoping I'd be able to hide it behind apache on the webserver using a virtual host and proxypass configuration something like:

<VirtualHost *:80>
ServerName my.domain.name
DocumentRoot "/var/www/site_home_directory"

<Directory "/var/www/site_home_directory">
allow from all
Options +Indexes
</Directory>

ProxyRequests Off

ProxyPass / http://local_ip_address:8080/MyAppName/
ProxyPassReverse / http://local_ip_address:8080/MyAppName/

</VirtualHost>

Which I had hoped would result in requests for http://my.domain.name/ forwarding on to http://ip_address:8080/MyAppName/. This has a number of advantages:

* It's simple
* I could, in future, deploy several apps to tomcat without having to take the root context
* I can packages resources such as javascript, images and css in the war and use root-relative paths to access them (even if this is a bad hing to do)

Superficially, this all appears to work fine. However, any struts-generated paths such as those that result from the <html:form> and <html:link> tags always get generated with the context name, which then breaks my proxypass.

<html:form action="/executeSearch.do" focus="name">

results in

<form id="service" method="post" action="/MyAppName/executeSearch.do;jsessionid=215E9DB58CEA11F6BDEFEEC07A707AB4">

while <html:link forward="site_advanced_search">Advanced search</html:link> results in

<a href="/MyAppName/advancedSearch.do;jsessionid=215E9DB58CEA11F6BDEFEEC07A707AB4">Advanced search</a>

I've spent most of the lst couple of days trying to find an answer on the web, and loads of people have asked a similar question, but there never seems to be a reasonable answer. Some have suggested not using the html taglibrary, which doesn't seem sensible. Others have suggested writing filters to strip the context name, which seems like overkill. There's also talk of using <html:base>, but I'm sure that's missing the point.

This must have been done before. I guess I'm hoping there's a config option somewhere that will force the generated paths to be root-relative.

Cany anyone help?
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, Andy. No such config option exists to my knowledge.
 
Andy Westley
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anyone suggest any practical solutions to the problem then? Is the only real answer that I'll need to deploy the app as the ROOT context? That does seem a bit of a limitation.
[ October 22, 2006: Message edited by: Andy Westley ]
 
Men call me Jim. Women look past me to this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic