0
votes

I have been trying to replicate ProxyPass and ProxyPassReverse on my website hosted on Hostgator Centos server. I have a tomcat application running on Amazon ec2 with URL http://myec2address.com:8080/portal/

I successfully replicated the use case on local windows machine with following configuration on httpd-proxy-html file.

ProxyPass /portalBI http://{localhost}:8080/poratalBI

ProxyPass /sw-style http://{localhost}:8080/sw-style

ProxyPass /portal-style http://{localhost}:8080/portal-style

ProxyPassReverse /portalBI http://{localhost}:8080/agrometricsBI

ProxyPassReverse /sw-style http://{localhost}:8080/sw-style

ProxyPassReverse /portal-style http://{localhost}:8080/portal-style

Since hosted website is on shared serveer, I assume that i will have to modify my .htaccess file. I have tried many tricks but no success. Can you please help on this ? Do we need to take care of special characters because of centOS ?

Thanks.

1

1 Answers

1
votes

You can't use either ProxyPass or ProxyPassReverse in an htaccess file. The best you can do is reverse proxy (equivalent of ProxyPass) using mod_rewrite's P flag:

RewriteEngine On
RewriteRule ^portalBI(.*)$ http://localhost:8080/poratalBI$1 [L,P]
RewriteRule ^sw-style(.*)$ http://localhost:8080/sw-style$1 [L,P]
RewriteRule ^portal-style(.*)$ http://localhost:8080/portal-style$1 [L,P]

That won't work unless your shared host has mod_proxy loaded, and plus you don't get the reverse location rewrites that you would with ProxyPassReverse.