在Hybris中设置mod_jk重定向
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在Hybris中设置mod_jk重定向相关的知识,希望对你有一定的参考价值。
我在我的app服务器上安装了apache httpd 2.2.15。当我点击https://ip_address:9002/xxstorefront/xx/en/USD/login时,我需要获取登录页面(https://dev.xxyy.com/login)。我已为我的域安装了SSL证书,并设置了重定向规则。
ProxyPass /login http://localhost:9001/xxstorefront/xx/en/USD/login
ProxyPassReverse /login http://localhost:9001/xxstorefront/xx/en/USD/login
ProxyPass /login https://localhost:9002/xxstorefront/xx/en/USD/login
ProxyPassReverse /login https://localhost:9002/xxstorefront/xx/en/USD/login
RewriteEngine On
RewriteRule ^(.*)/login http://%{ip_address:9001}$1/{xxstorefront/xx/en/USD/login}$2 [L,R]
当我击中https://dev.xxyy.com/login时,我得到以下错误,
Not Found
The requested URL /login was not found on this server.
Apache/2.2.15 (CentOS) Server at dev.xxyy.com Port 443
当我点击https://dev.xxyy.com时,我得到了apache默认主页。
请指导我如何设置重定向规则。
答案
您的配置无效。这两行:
ProxyPass /login https://localhost:9002/xxstorefront/xx/en/USD/login
ProxyPassReverse /login https://localhost:9002/xxstorefront/xx/en/USD/login
覆盖这两个:
ProxyPass /login http://localhost:9001/xxstorefront/xx/en/USD/login
ProxyPassReverse /login http://localhost:9001/xxstorefront/xx/en/USD/login
重写机制可能根本不起作用:
RewriteEngine On
RewriteRule ^(.*)/login http://%{ip_address:9001}$1/{xxstorefront/xx/en/USD/login}$2 [L,R]
我认为这个配置可以解决你的问题:
<VirtualHost *:80>
ServerName dev.xxyy.com
ProxyPreserveHost On
ProxyPass / http://localhost:9001/xxstorefront/xx/en/USD/
ProxyPassReverse / http://localhost:9001/xxstorefront/xx/en/USD/
</VirtualHost>
<VirtualHost *:443>
ServerName dev.xxyy.com
SSLEngine on
// other SSL directives
ProxyPreserveHost On
ProxyPass / https://localhost:9002/xxstorefront/xx/en/USD/
ProxyPassReverse / https://localhost:9002/xxstorefront/xx/en/USD/
</VirtualHost>
它定义了两个虚拟主机作为代理,并将所有请求映射到xxstorefront/xx/en/USD/...
:
http://dev.xxyy.com/(.*) → http://localhost:9001/xxstorefront/xx/en/USD/(.*)
https://dev.xxyy.com/(.*) → https://localhost:9002/xxstorefront/xx/en/USD/(.*)
以上是关于在Hybris中设置mod_jk重定向的主要内容,如果未能解决你的问题,请参考以下文章
如何在django oscar中设置Paypal重定向网址?
如何在 AWS S3 网站 CloudFront 中设置别名重定向?