----- Original Message -----
From: "G.W. Haywood" <[EMAIL PROTECTED]>
To: "Les Mikesell" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, January 05, 2001 1:44 PM
Subject: Re: [OT] Rewrite arguments?


> On Thu, 4 Jan 2001, Les Mikesell wrote:
>
> > This may or may not be a mod_perl question:
>
> Probably not :)

I have a feeling it is going to end up being possible only
with LWP...

> > I want to change the way an existing request is handled and it can be done
> > by making a proxy request to a different host but the argument list must
> > be slightly different.    It is something that a regexp substitution can
> > handle and I'd prefer for the front-end server to do it via mod_rewrite
> > but I can't see any way to change the existing arguments via RewriteRules.
>
> I don't exactly understand your problem, but from what I can see you
> should be able to do what you want with mod_rewrite if you just use a
> regexp which contains a question mark.  Have I missed something?

One of us is missing something.  I hope it is me, but when I turn on
rewrite logging, the input side contains only the location portion.  The
argument string has already been stripped.  Apparently it is put back
in place after the substition, since  ^(.*)$  http://otherserver$1  [P] will
send the same arguments on to the downstream host.

> Does this extract from the docs help?
> ----------------------------------------------------------------------
> One more note: You can even create URLs in the substitution string containing
> a query string part. Just use a question mark inside the substitution string
> to indicate that the following stuff should be re-injected into the
> QUERY_STRING.  When you want to erase an existing query string, end the
> substitution string with just the question mark.

This allows adding additional arguments, or deleting them all.  I want to
change an existing one and add some more.  Something like:
/cgi-bin/prog?arg1=22&arg2=24 should become:
   http://otherhost.domain/prog?newarg1=22&arg2=24&uname=me&pwd=password


> Note: There is a special feature: When you prefix a substitution field
> with http://thishost[:thisport] then mod_rewrite automatically strips
> it out.  This auto-reduction on implicit external redirect URLs is a
> useful and important feature when used in combination with a
> mapping-function which generates the hostname part.  Have a look at
> the first example in the example section below to understand this.

That won't affect this case.  The hostname will be fixed and always
require the proxy mode.

       Les Mikesell
         [EMAIL PROTECTED]

Reply via email to