Question

how, if possible, can I redirect a request for a hostname to a specific subdirectory of one of the deployed apps?

E.g., I wish to forward

http://host.com 

to

http://host.com/app/path

It is however possible to redirect to a specific application on tomcat, e.g.,

    <Host name="host.com" appBase="webapps">
        <Context path="/" docBase="webapps/app" debug="6"/>
    </Host>

But I've never managed to redirect it to a subpath of an application. I'd fancy a tomcat-only approach over using an external mod_proxy with apache2 to achieve this.

Was it helpful?

Solution 2

This does not seem possible. Final solution was to use mod_proxy of Apache2 to proxy the request.

OTHER TIPS

This worked for me by changing path to "" (i.e. making it default web app for the Host)

<Host name="host.com" appBase="webapps">
            <Context path="" docBase="webapps/app" debug="6"/>
        </Host>

It serves static files correctly, but my JSTL fails now.

Anyways, can you try?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top