My intent is very simple, I would like to type example.com and be redirect to example.com:8080/myapp

example.com:8080/myapp is a java/tomcat app.

    <VirtualHost *:80>

    ServerName example.com

    ProxyPass / example.com:8080/myapp/
    ProxyPassReverse / example.com:8080/myapp/
    ProxyRequests Off
    RewriteEngine on
    RewriteRule ^(/.*) example.com:8080/myapp/$1 [P]

    <Proxy example.com:8080/myapp*>
            Order deny,allow
            Allow from all

    ErrorLog ${APACHE_LOG_DIR}/error.log


And the result is when I type http://example.com it's redirected to example.com:8080/myapp/myapp

My file server.xml from Tomcat has the follow instruction:

      Connector port="8080" protocol="HTTP/1.1"
           proxyPort="80" proxyName="example.com"

What I am not seeing?

  1. The rewriterule should not be needed. What about deleting it?
  2. Can you modify the virtual host to:

    <Location / >
            ProxyPass  http://localhost:8080/myapp
            ProxyPassReverse  http://localhost:8080/myapp

    (I removed a trailing slash)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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