Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why are my assets not served through a reverse proxy in apache

I have a rails app running on passenger standalone, which is working perfectly. I am running apache, and use a VirtualHost with a reverse proxy to serve my rails app. This works. However my assets are not being served through the vhost, but give a proxy error.

My httpd.conf

<VirtualHost *:80>
    ServerName greekpeep_rails.nightowls.co
    DocumentRoot /home/railsapps/www/greekpeep/public
    ProxyPass / http://127.0.0.1:4000
    ProxyPassReverse / http://127.0.0.1:4000
   <Directory /home/railsapps/www/greekpeep/public>
        Allow from all
        Options -MultiViews
    </Directory>
</VirtualHost>

The proxy error

Proxy Error

The proxy server received an invalid response from an upstream server. The proxy server could not handle the request GET /assets/application- 6fc7d25aa72d2a014ae6b36136c2fbfc.css.

Reason: DNS lookup failure for: 127.0.0.1:4000assets

Note that 127.0.0.1:4000 works perfectly and is correctly serving the assets. greekpeep_rails.nightowls.co loads the page, but not the assets.

like image 681
Arjan Avatar asked Mar 29 '12 16:03

Arjan


Video Answer


1 Answers

Looks like you are missing a / at the end of your ProxyPass definitions.

ProxyPass / http://127.0.0.1:4000/
ProxyPassReverse / http://127.0.0.1:4000/
like image 101
mguymon Avatar answered Sep 27 '22 17:09

mguymon