Search code examples
apachealiasvirtualhostassetsmod-alias

Using apache mod_alias in vhost to link assets from external server


This is an outside shot I know. I am supporting a site that has constantly changing assets that are excluded from the repository for obvious reasons. Currently I am having to FTP these assets to my local computer in order to develop and test properly. What I want to do is simply link to the assets on the server. I thought this might be possible using Apache's mod_alias, but I cant get it to work:

Alias /assets http://www.mysite.com/assets

Is this possible? Is there an alternative way of doing this?

Thanks


Solution

  • You can use mod_proxy to make Apache fetch resources from a remote server and then return them under that URL:

    ProxyRequests Off
    ProxyPass /assets http://www.mysite.com/assets
    ProxyPassReverse /assets http://www.mysite.com/assets
    

    http://httpd.apache.org/docs/2.0/mod/mod_proxy.html