2011-06-15 27 views
0

我希望能夠轉發URL,例如定製的mod_jk轉發

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 

我已經能夠在標準鏡子URL轉發到tomcat的應用程序,但無法自定義external_url這樣做,任何想法?

我嘗試使用ProxyPathMatch

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

但是Apache笙歌稱其不正確。

非常感謝您的幫助。

回答

0

mod_jk不像mod_proxy,你可以用這種方式重寫URL。你可以做這樣的事情:

JkMount /auth myAuthApp 

然後在worker.properties定義相應的應用程序:

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

但是你的Tomcat應用程序必須能夠聽正確的上下文路徑上。在這種情況下,它將是/ auth,而不是/ app/auth。

你可以做各種整潔的轉發,使用cookies,URIs等等。但是應用程序仍然會獲得原始路徑,並且必須能夠響應它。

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

+0

作爲後續,則可以使用與重寫規則[L,PT]做重寫,然後通過重寫路徑進入的mod_jk。 – 2011-07-06 10:56:22