You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Rick Lowe <rl...@netegrity.com> on 2001/12/28 16:45:22 UTC

[2]RE: one proxy host--2 backend systems with same directory structure.

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(.*)  http://nt.backend.com:88/$1  [P]
RewriteCond %{HTTP_REFERER} http://solaris.test.com/insite     [NC]
RewriteRule  ^/images(.*)  /insite/images$1 [R,L]


RewriteRule  ^/ibm(.*)  http://nt.backend.com:90/$1  [P]
RewriteCond %{HTTP_REFERER} http://solaris.test.com/ibm     [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
required?

Thanks in advance,
Rick

  -----Original Message-----
  From: Joshua Slive [mailto:joshua@slive.ca]
  Sent: Saturday, December 08, 2001 12:17 PM
  To: users@httpd.apache.org; rlowe@netegrity.com
  Subject: Re: one proxy host--2 backend systems with same directory
structure.




  On Fri, 7 Dec 2001, Rick Lowe wrote:

  > Issue:
  > Front ending two backend systems which have the same directory
structure,
  > 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
to
  > serve up locally. So I setup a rewrite rule which prepends /ibm or
/insite
  > to the request. Problem is that only the first rewrite match gets
executed.
  > 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.

  Joshua.