简体   繁体   中英

custom mod_jk forwarding

i want to be able to forward url such as

http://external_url.com/auth => http://internal_url.com:8080/app/auth
https://external_url.com/w/my-account => https://internal_url.com:8080/app/LogIn.do
https://external_url.com/w/forgot-password => https://internal_url.com:8080/app/ForgotPassword.do
https://external_url.com/w/register-user => https://internal_url.com:8080/app/CustomerRegistration.do
http://external_url.com/w/logout =>  https://internal_url.com:8080/app/LogIn.do

I am already able to forward the standard mirror url to the tomcat apps, but unable to do so for the custom external_url, any ideas?

I tried using ProxyPathMatch :

ProxyPathMatch ^(/\/w\/forgot\-password)$ http://internal_url.com:8080 /app/ForgotPassword.do 

but Apache complains saying its incorrect.

much appreciate for the help.

mod_jk isn't like mod_proxy in that you can rewrite the URL in this way. You can do something like this:

JkMount /auth  myAuthApp

And then define in worker.properties the appropriate application:

worker.list=myAuthApp
worker.myAuthApp.host=internal_url.com
worker.myAuthApp.port=8080

But your tomcat application must be able to listen on the right context path. In this case it will be /auth, not /app/auth.

You can do all sorts of neat forwarding, using cookies, URIs and much more. But the application will still get the original path and must be able to respond to it.

http://tomcat.apache.org/connectors-doc/reference/apache.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM