简体   繁体   中英

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.

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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM