开发者

Proxy tomcat urls to map a host request to a path

开发者 https://www.devze.com 2023-01-15 22:04 出处:网络
how, if possible, ca开发者_运维知识库n I redirect a request for a hostname to a specific subdirectory of one of the deployed apps?

how, if possible, ca开发者_运维知识库n 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.


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?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消