在Hybris中设置mod_jk重定向

问题描述 投票:0回答:1

我在我的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默认主页。

请指导我如何设置重定向规则。

apache tomcat port hybris mod-jk
1个回答
1
投票

您的配置无效。这两行:

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/(.*)
© www.soinside.com 2019 - 2024. All rights reserved.