简体   繁体   中英

Setting up mod_jk redirect in Hybris

I have installed apache httpd 2.2.15 in my app server. I need to get the login page( https://ip_address:9002/xxstorefront/xx/en/USD/login ) when I hit on https://dev.xxyy.com/login . I have installed SSL certificate for my domain and set below redirect rules.

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] 

When I hit on https://dev.xxyy.com/login , I get below error,

Not Found 
The requested URL /login was not found on this server.
Apache/2.2.15 (CentOS) Server at dev.xxyy.com Port 443 

When I hit on https://dev.xxyy.com , I get the apache default homepage.

Pls guide me how should I set the redirect rules.

Your configuration is invalid. Those two lines:

ProxyPass         /login https://localhost:9002/xxstorefront/xx/en/USD/login
ProxyPassReverse  /login https://localhost:9002/xxstorefront/xx/en/USD/login

overwrite those two:

ProxyPass         /login http://localhost:9001/xxstorefront/xx/en/USD/login
ProxyPassReverse  /login http://localhost:9001/xxstorefront/xx/en/USD/login

Rewite mechanism probably does not work at all:

RewriteEngine On
RewriteRule ^(.*)/login http://%{ip_address:9001}$1/{xxstorefront/xx/en/USD/login}$2 [L,R]

I think this configuration should solve your problem:

<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>

It defines two virtual hosts which work as proxies and map all requests to 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/(.*)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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