On Thu 28 Feb 2008, J. Peng wrote:
> currently I write it with PerlAccessHandler, it also works. is it
> right with this handler?


Do you want to send a redirect to the browser (HTTP code 3xx)? If yes then =
it=20
can be done in an access handler as well. If you simply want to send the=20
document in /pathA or /pathB then I think you'd prefer something *before* t=
he=20
core map_to_storage handler, that means a PerlTransHandler or a=20
PerlMapToStorageHandler since otherwise you'd need to fill out the finfo=20
field by yourself, see

http://perl.apache.org/docs/2.0/api/....html#C_finfo_

> no, mod_rewrite can't rewrite requests based on Accept-Encoding header.


yes, something like this:

RewriteCond %{HTTP:Accept-Encoding} gzip [OR]
RewriteCond %{HTTP:Accept-Encoding} deflate
RewriteRule ^(.*) /pathA/$1 [PT,L]

RewriteRule ^(.*) /pathB/$1 [PT,L]

or as an external redirect:

RewriteCond %{HTTP:Accept-Encoding} gzip [OR]
RewriteCond %{HTTP:Accept-Encoding} deflate
RewriteRule ^(.*) /pathA/$1 [R,L]

RewriteRule ^(.*) /pathB/$1 [R,L]

Why do you think this wouldn't work?

> On Thu, Feb 28, 2008 at 7:26 PM, Torsten Foertsch
>
> wrote:
> > On Thu 28 Feb 2008, J. Peng wrote:
> > =A0> I need to write an input filter based on the request headers.
> > =A0> If request includes a "Accept-Encoding: gzip, deflate" header, I
> > =A0> should redirect the request to /pathA.
> > =A0> If request doesn't include that header, I should redirect the requ=

est
> > to > /pathB. (pathA and pathB are web document dirs on web server.)
> >
> > =A0I think you don't need an input filter. What you need is a
> > PerlTransHandler or a PerlMapToStorageHandler that checks
> > $r->headers_in->{'Accept-Encoding'} and sets $r->filename and/or $r->uri
> > accordingly.
> >
> > =A0This can even be done with mod_rewrite.


Torsten

=2D-
A: It reverses the normal flow of conversation.
Q: What's wrong with top-posting?
A: Top-posting.
Q: What's the biggest scourge on plain text email discussions?