简体   繁体   English

自定义mod_jk转发

[英]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? 我已经能够将标准镜像URL转发到tomcat应用程序,但是对于自定义external_url不能这样做,有什么想法吗?

I tried using ProxyPathMatch : 我尝试使用ProxyPathMatch

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

but Apache complains saying its incorrect. 但是Apache抱怨说它不正确。

much appreciate for the help. 非常感谢您的帮助。

mod_jk isn't like mod_proxy in that you can rewrite the URL in this way. mod_jk与mod_proxy不同,您可以通过这种方式重写URL。 You can do something like this: 您可以执行以下操作:

JkMount /auth  myAuthApp

And then define in worker.properties the appropriate application: 然后在worker.properties中定义适当的应用程序:

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. 但是您的tomcat应用程序必须能够在正确的上下文路径上进行侦听。 In this case it will be /auth, not /app/auth. 在这种情况下,它将是/ auth,而不是/ app / auth。

You can do all sorts of neat forwarding, using cookies, URIs and much more. 您可以使用cookie,URI等进行各种巧妙的转发。 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 http://tomcat.apache.org/connectors-doc/reference/apache.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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