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

跟風遠走 提交于 2019-12-22 04:03:44

问题


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.


回答1:


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/


来源:https://stackoverflow.com/questions/9929298/why-are-my-assets-not-served-through-a-reverse-proxy-in-apache

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!