0

I'm using Apache2 to perform Reverse Proxy for my tomcat.

my domain name is https://dev.domain.com to be redirected to http://127.0.0.1:8080/MyApp

proxy is ok but tomcat is having an asset folder located in the root folder (http://127.0.0.1:8080/assets)

while loading my dev.domain.com page I have a 404 Error for every assets elements to be displayed. Here is my VirtualHost configuration:

<VirtualHost *:443>

    ServerAdmin webmaster@localhost

    proxyRequests Off
    SSLProxyEngine on

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    ServerName dev.domain.com

    ProxyPass / http://127.0.0.1:8080/MyApp/
    ProxyPassReverse / http://127.0.0.1:8080/MyApp/

    SSLCertificateFile ....

</VirtualHost>

it seems that everything which is not in the MyApp folder is not correctly redirected, do you know I can do that ?

tiamat
  • 103
  • 4

1 Answers1

1
ProxyPass / http://127.0.0.1:8080/MyApp/

Is making all requests to '/' proxied to 'http://127.0.0.1:8080/MyApp/'. This means that requesting '/assets' will translate to 'http://127.0.0.1:8080/MyApp/assets'. I think you have two choices:

  • either move 'assets' directory inside 'MyApp'
  • or add a separate ProxyPass/ProxyPassReverse for 'assets' directory

    ProxyPass /assets/ http://127.0.0.1:8080/assets/
    ProxyPassReverse /assets/ http://127.0.0.1:8080/assets/
    
Julien
  • 78
  • 1
  • 8
  • by adding ProxyPass /assets/ http://127.0.0.1:8080/assets/ ProxyPassReverse /assets/ http://127.0.0.1:8080/assets/ first in the conf file it works perfectly, thanks Julien – tiamat Mar 29 '19 at 19:32