Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I know that there are possible duplicates on serverfault, but I read a lot (not only the last days) but I couldn't make it working 100%.

I have the domain http://jetwick.de bought via Strato and then I have a server with a static IP. I can configure the DNS settings for jetwick.de at Strato: the IP directly points to the IP of our server via A-Record. This works.

Now I want that my application which is available from tomcat under localhost:8080/jetwick is shown under jetwick.de - nothing more :)

I have the following apache config on our server /etc/apache2/vhosts/jetwick

<Virtualhost *:80>
      ServerName http://jetwick.de
      ServerAlias jetwick.de www.jetwick.de jetwick.com www.jetwick.com

      ProxyRequests Off
      ProxyPreserveHost On   

      ProxyPass / http://localhost:8080/jetwick/
      ProxyPassReverse / http://localhost:8080/jetwick/

</Virtualhost>

This partially works. But I have problems when I query:

  1. jsessionid should NOT be shown - only for clients which do not allow cookies. I guess the cookie info gets lost somewhere like the favicon ...?
  2. an additional directory jetwick.de/jetwick will be shown (in the following request the jsessionid disappears)

How would you fix that? You can also point me to a site/duplicate where this case is described, of course!

Do I need mod_jk to make cookies properly working like the answer here suggests?

Update The following settings solved the first (cookie) problem:

ProxyPassReverseCookiePath /jetwick /

share|improve this question

1 Answer 1

Hmmm. Try migrating to a mod_proxy_ajp config first (assuming you have it included - it's a stock module with many modern Apache installs) to see if that does it. First, make sure your port 8009 AJP connector is uncommented in Tomcat's server.xml:

<Connector enableLookups="false" port="8009" protocol="AJP/1.3" redirectPort="8443" URIEncoding="UTF-8" />

Then set up Apache pretty much the same; you might consider using a one-node pool so that you can have it "see" the jsessionid. Then add some rewrite rules to mask the directory name:

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/jetwick/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /jetwick/$1

ProxyPass /jetwick/ balancer://local/ stickysession=JSESSIONID|jsessionid
<Proxy balancer://local>
  BalancerMember ajp://127.0.0.1:8009
</Proxy>

I don't have a Tomcat engine handy right now to test that, but it looks right when I read it... :) You might need a [PT] flag on the rewriterule, play with it and see what you get.

share|improve this answer
    
Thanks for the answer. I hired an admin (I needed it quick) who was able to solve this for me with the used mod_proxy and some rewrite rules :) –  Karussell Feb 5 '11 at 20:16
    
You should post his solution then, so that everyone may learn. :) –  troyengel Feb 6 '11 at 6:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.