httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject Re: [users@httpd] Rewrite relative image paths in a reversed proxy setup
Date Mon, 17 Nov 2008 16:25:03 GMT
Bocalinda wrote:
> Hi André.
> 
> 
>>> Applying what you explained above, this would mean that my images paths
>>> will
>>> be resolved as:
>>> http://172.18.0.1/SEDO/image.gif
>>>
>>> Which of course will not work.
>>>
>> Why "of course" ?
>> I may be thick, but I must admit I do not really understand your problem.
>>
> Sorry for the confusion, the above image.gif URL wasn't correct.
> If the image path is relative in the form of "image.gif" then the correct
> path would be:
> http://172,18.0.1/image.gif and this of course will not work. (see below)
> 
>> What I mean is : if the page your browser sees contains a tag <img
>> href="image.gif">, the browser will resolve this according to the location
>> from which it got the page that contains that link.
>> That's how browsers work, and are supposed to work.
>> If you do not want this, then do not put relative links in the pages, put
>> absolute links.
>> Like <img href="/images/image.gif">.
>> The browser, mind you, will still resolve this according to the host from
>> which it got your page, but this time will look for
>> http://172.18.0.1/images/image.gif.
>>
>> But what do you want to happen, really ?
>> Where would you like the image to come from ?
>>
> 
> Hmm, ok. Let me explain what I think is going wrong.
> 
> I request http://172,18.0.1/SEDO.
> As you can see in my Apache configuration, the SEDO location requests will
> be proxied to Tomcat cluster1.
> Let's say that the request will be send to 172.18.0.39. Bear in mind that
> the URL in my browser won't change. That's the whole idea behind a reverse
> proxy. For the client it seems that Apache is serving my pages, while in
> reality it's one of my Tomcat servers in my cluster. Thus, my browser URL is
> still 172.18.0.1.
> 
> Anyway, as you stated, any relative img paths will be resolved to
> http://172.18.0.1/image.gif.
> But (and this is where the problem is located), this URL will not be proxied
> to any of my Tomcat clusters, because the URL does not contain SEDO or
> SEDO-NEW 

Sorry, maybe I did not use the correct example before, but that is wrong.
If you original request is
http://172,18.0.1/SEDO
and from there, your browser receives an html page (wherever it came 
from), and that html page contains a link <img href="image.gif">, then 
the browser will request
http://172,18.0.1/SEDO/image.gif

wait a minute.. maybe it won't. Because it would remove the "SEDO", for 
being the last path component, and replace it by "image.gif".
Now I think I get it.
The browser would have to know that it is not really getting "SEDO", but 
  /SEDO/something.
Hmmm.

I guess that the only way to make this work (if you cannot change the 
<img> links in the pages), would be to force a re-direct to the real 
thing, when the browser requests "SEDO".

What is the resource that the browser really obtains when it requests
http://172,18.0.1/SEDO ?
(this must be something on your Tomcats)


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message