1

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

    ProxyRequests Off
    <Proxy *>
            Order deny,allow
            Allow from all
    </Proxy>

    ProxyPass / http://example.com:8080/myapp/
    ProxyPassReverse / http://example.com:8080/myapp/

    <Location />
            Order deny,allow
            Allow from all
    </Location>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    LogLevel info

    CustomLog ${APACHE_LOG_DIR}/access.log combined

   </VirtualHost>

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"
       connectionTimeout="20000"
       URIEncoding="UTF-8"
       proxyPort="80" proxyName="example.com"

What I am missing?

1 Answer 1

1

Proxypass change the server name part, but not the ressource id one:

Instead of :

ProxyPass / http://example.com:8080/myapp/
ProxyPassReverse / http://example.com:8080/myapp/

Use:

ProxyPass / http://example.com:8080/
ProxyPassReverse / http://example.com:8080/

Edit:

Then add:

RewriteEngine on
RewriteRule ^/$ /myapp [PT]
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for your answer Cukic0d, I tried this configuration. When I try this the page load the tomcat main page, and I would like to load the main app first page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.