Hi, Chris-

Here's an alternative:

  RewriteCond %{HTTP_USER_AGENT} Firefox/
  RewriteCond %{HTTP_USER_AGENT} !Firefox/(3\.0\.19|3\.5\.9|3\.6\.3)($|[^\.0-9])
  RewriteRule .* /bad-browser.jsp [L]

And set the status in the JSP.

By the way, I'm a little confused by the character class in the last pair of alternatives of second 
condition. Did you want "not a '.' or digit" or "not (a '.' followed by a 
digit)"?

-Terence

Christopher Schultz wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Terrence,

On 6/30/2010 7:55 PM, Terence M. Bandoian wrote:
This should redirect to /bad-browser.shtml:

   RewriteCond %{HTTP_USER_AGENT} Firefox/
   RewriteCond %{HTTP_USER_AGENT}
!Firefox/(3\.0\.19|3\.5\.9|3\.6\.3)($|[^\.0-9])
   RewriteRule .* /bad-browser.shtml [R=307,L]

That's an interesting suggestion, but one that will result in one
request getting a 403 response and then a second getting a 200 response.
I'd prefer only a single request if possible.

Looks just about like what you already had though.

I'm not sure the substitution is applied with F(orbidden).

It turns out that when using [F], my ErrorDocument was kicking-in, which
was then being re-redirected by the RewriteRule, resulting in an endless
loop that httpd finally terminated, which explains this:

        RewriteRule .* /bad-browser.shtml [L,F]

This gives me a 403 response code, httpd's standard "forbidden" page,
and a 500 response code in the access log (looks like a runaway
redirect... I'll have to fix that).

One option would be to set up a pass-through rule like this:

RewriteRule /forbidden.html - [L]

Thanks,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkwr7BQACgkQ9CaO5/Lv0PC89wCfYHB7N53ux0sqVRMR//0T6FQh
rAoAn3WoY4/4KsU8fsglHFT88TLxkUja
=lqk6
-----END PGP SIGNATURE-----


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to