httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bocalinda <bocali...@gmail.com>
Subject Re: [users@httpd] Rewrite relative image paths in a reversed proxy setup
Date Mon, 17 Nov 2008 16:04:06 GMT
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 (which is how I detect to send a request to cluster1 or cluster2).
Thus, Apache will try to load the image from it's local htdocs folder, and
exactly..there is no such image there.

Please let me know if you understand my description.
Thanks in advance.

Mime
View raw message