开发者

custom mod_jk forwarding

开发者 https://www.devze.com 2023-03-13 12:17 出处:网络
i want to be able to forward url such as http://external_url.com/auth => http://internal_url.com:8080/app/auth

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 =&g开发者_Go百科t; 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

0

精彩评论

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