Skip to content

Instantly share code, notes, and snippets.

@jaehoo
Last active December 14, 2015 08:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaehoo/5058940 to your computer and use it in GitHub Desktop.
Save jaehoo/5058940 to your computer and use it in GitHub Desktop.
Apache Proxy + Sprong Security, fix to reqrite url and use apache in front of java app server
<IFModule mod_proxy.c>
<VirtualHost *:80>
DocumentRoot "/var/www/html"
<Directory "/var/www/html">
AllowOverride All
Allow from All
</Directory>
ServerAdmin webmaster@orbitalzero.com
ServerName proveedores.ephb2b.com.mx
ServerAlias tomcat
RewriteEngine on
ReWriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
</VirtualHost>
</IFModule>
<IFModule mod_ssl.c>
<VirtualHost *:443>
ServerName labs.orbitalzero.com
#
# Portal Java Web App
#
ProxyPass / ajp://localhost:8009/MyApp/
ProxyPassReverse / ajp://localhost:8009/MyApp/
ProxyPassReverseCookiePath /MyApp /
ProxyRequests off
ProxyPreserveHost On
<proxy >
Order deny,allow
Allow from all
</proxy>
RewriteEngine on
# FIX For Spring Security
RewriteRule ^/MyApp/(.*)$ ajp://localhost:8009/MyApp/$1 [P,L]
#RewriteRule ^/MyApp/ephb2b_login$ ajp://localhost:8009/MyApp/ephb2b_login$1 [P]
#RewriteRule ^/MyApp/(.*)$ /$1 [R=301]
SSLEngine on
SSLProxyEngine on
SSLCertificateFile /etc/apache2/certs/root.crt
SSLCertificateKeyFile /etc/apache2/certs/eph.pem
SSLCertificateChainFile /etc/apache2/certs/inter.crt
</VirtualHost>
</IFModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment