Philippxp
Philippxp

Reputation: 367

Reverse proxy with Apache and static content behind application inside of jetty

My applications is spring based and served by jetty. The current setup looks like this.

Apache - > Reverse proxy -> Embedded Jetty -> Application

When I access the app directly (http://127.0.0.1:15000) without reverse proxy the static resources are loaded (css, .js etc) but if I access it through reverse proxy (https://127.0.0.1/app/) it doesn't work.

Here are my configs.

apache2.conf

ProxyPass /app/ http://127.0.0.1:15000/
ProxyPassReverse /app/ http://127.0.0.1:15000/
SSLProxyEngine on 

RewriteEngine On
RewriteRule /app$ /app/ [R]

spring-servlet.xml

 ...
 <mvc:default-servlet-handler />
 <mvc:resources mapping="/resources/**" location="/resources/" />
 ... 

I would like that in both ways the static content will be delivered.

Upvotes: 1

Views: 1583

Answers (1)

shazinltc
shazinltc

Reputation: 3666

I know this is too late. But for anyone who might end up here, Adding a mapping to your resources path will solve the problem.

ProxyPass /app/resources http://127.0.0.1:15000/app/resources
ProxyPassReverse /app/resources http://127.0.0.1:15000/app/resources

This should be added before your existing mapping.(longest URL comes first, as whichever mapping is read first, wins)

Upvotes: 2

Related Questions