httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rick Lowe" <>
Subject [2]RE: one proxy host--2 backend systems with same directory structure.
Date Fri, 28 Dec 2001 15:45:22 GMT
Re: one proxy host--2 backend systems with same directory structure.Ok,
understood that absolute links can be messy and that all content behind a
reverse proxy should be written with a reverse proxy in mind.

However, if one did want to use identical absolute links on multiple backend
systems it is possible to proxy the request to the correct backend system
using http_referer, as Joshua pointed out.

Here is how I have this setup and seems to work.  So far.

RewriteRule  ^/insite(.*)$1  [P]
RewriteCond %{HTTP_REFERER}     [NC]
RewriteRule  ^/images(.*)  /insite/images$1 [R,L]

RewriteRule  ^/ibm(.*)$1  [P]
RewriteCond %{HTTP_REFERER}     [NC]
RewriteRule  ^/images(.*)  /ibm/images$1 [R,L]

Question is weather or not there is a cleaner way to set this up so that for
each backend directory/absolute link an additional rule would not be

Thanks in advance,

  -----Original Message-----
  From: Joshua Slive []
  Sent: Saturday, December 08, 2001 12:17 PM
  Subject: Re: one proxy host--2 backend systems with same directory

  On Fri, 7 Dec 2001, Rick Lowe wrote:

  > Issue:
  > Front ending two backend systems which have the same directory
  > but different content in respective directories.
  > for example
  > <http://proxyhost/ibm> -->maps to -->. <http://backend.system.1/>
  > example link
  > (<A HREF="/images/image1.gifp">
  > /images)
  > <http://proxyhost/inside> -->maps to --> <http://backend.system2:90/>
  > example link
  > (<A HREF="/images/image1.gif">
  > /images)
  > The link directs browser browser to /images which the proxy host tries
  > serve up locally. So I setup a rewrite rule which prepends /ibm or
  > to the request. Problem is that only the first rewrite match gets
  > see example config below.

  You can't use absolute URLs in a reverse proxy setup without a great deal
  of gymnastics.  It just fundementally doesn't work.  You should change the
  links on the backend server to relative links so that everything stays
  under the /ibm directory.

  > RewriteCond %{REQUEST_URI} !(^/insite(.*)$)
  > RewriteRule ^/images(.*) /insite/images$1 [R]

  This doesn't make any sense to me.  RewriteRule is itself matching against
  the REQUEST_URI.  If the URI is /insite, then it can't simultaneously be
  /images.  Perhaps you don't understand that each request to the server is
  completely independent.  The only way to do something like this is by
  looking at the HTTP_REFERER to see where the link was from.  But I don't
  recommend this configuration, because the browser is not necessarily going
  to send sensible things in the Referer header.


View raw message