在 Hybris 中设置 mod_jk 重定向

Setting up mod_jk redirect in Hybris

我已经在我的应用程序服务器中安装了 apache httpd 2.2.15。我需要获取登录页面(https://ip_address:9002/xxstorefront/xx/en/USD/login) when I hit on 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}/{xxstorefront/xx/en/USD/login} [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}/{xxstorefront/xx/en/USD/login} [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/(.*)