Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Disclaimer: I am very new to mod_proxy and somewhat new to apache in general.

I have a very simple virtual host with the following configuration:

<VirtualHost *:80>
    ServerName myhost.mydomain


    <IfModule mod_proxy.c>
    ProxyRequests Off

    ProxyPass /mysite http://www.google.com
    ProxyPassReverse /mysite http://www.google.com

    </IfModule>

</VirtualHost>

When I go to http://myhost.mydomain/mysite it displays the expected result, ie Google's home page, but it does not send Google's images over. When I look at the source for an image, it is in terms of myhost.mydomain rather than a Google URI, which is expected. What isn't expected is why the images are not being fetched by mod_proxy and sent down to me. How do I make mod_proxy "recursive" a la mod_rewrite. In that same vein, if I am already familiar with mod_rewrite, why bother with mod_proxy at all?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Google's resources on the page are in the form img src="/images/srpr/logo3w.png" or similar; this causes them to be fetched from the root of the site.

Take a look at how you've configured proxying; /mysite/images/srpr/logo3w.png is the request the client browser would have needed to send to get the image. Switch to..

ProxyPass / http://www.google.com/

and everything ought to work.

mod_proxy_html is designed to alter link paths to function correctly in the context of the proxy, but don't count on it working correct for a site that you don't control, especially if any of the link building is done in client side javascript.

mod_rewrite and mod_proxy serve completely different purposes; if you use the [P] flag in mod_rewrite then you're actually utilizing mod_proxy, but in a less efficient way than just configuring ProxyPass.

share|improve this answer
    
Thank you for the info re: mod_proxy_html, since the situation of link building through clientside js is exactly the situation im facing –  tacos_tacos_tacos Oct 2 '12 at 21:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.