Monday, February 27, 2017

HTTP Server Proxy Configuration for Hybris

The following configuration can be applicable to any web application that is running in tomcat proxied with apache http server. But mod_jk perform better than http proxy and mod_jk provide more flexibility than http proxy

The following step to access electronics store and admin tools using apache http server
Uncomment the following modules from the httpd.conf file
LoadModule headers_module modules/mod_headers.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so
Enable https via uncommenting the followin from httpd.conf file
Include conf/extra/httpd-ssl.conf
LoadModule ssl_module modules/mod_ssl.so
Generate ssl certificate via running the command
\bin>openssl req -x509 -nodes -days 1095 -newkey rsa:2048 -out ../conf/server.crt -keyout ../conf/server.key -config ../conf/openssl.cnf
The file httpd-ssl.conf file is having reference to the conf/server.crt and conf/server.key files
Add the following lines to httpd-ssl.conf file
SSLProxyEngine on
Add the following lines to httpd.conf file
ProxyPass         /  https://electronics.local:9002/
ProxyPassReverse  /  https://electronics.local:9002/
ProxyPass         /hmc  http://localhost:9001/hmc
ProxyPassReverse  /hmc  http://localhost:9001/hmc
ProxyPass         /mcc  http://localhost:9001/mcc
ProxyPassReverse  /mcc  http://localhost:9001/mcc
ProxyPass         /backoffice  http://localhost:9001/backoffice
ProxyPassReverse  /backoffice  http://localhost:9001/backoffice
Open the tomcat's server.xml and add proxyPort="80" to the node for 9001 and proxyPort="443" for 9002
Restart http server
Restart tomcat
Open the following urls(assumption is that electronics.local is already mapped to the host file)
https://electronics.local/theworksstorefront/electronics/en/
http://electronics.local/hmc

No comments:

Post a Comment