Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] deny access based on user agent

There's a broken web crawler ignoring the site robots.txt which is pounding a webapp I'm running under jetty and generating a ton of noise in the application logs.

I'd like to deny access to it based on user agent, as it is consistently identifying itself at least.

What is the best way to do that with jetty? With Apache, I could use a rewrite rule to match against the user agent and return a 403.

I don't initially see a similar way to do that with jetty's rewrite engine; the ResponsePatternRule appears to allow overriding a specific response code, but it looks like you can only look at the URL to match against, not headers like the user agent?

There is a HeaderRule that looks like it would match against the user agent header, but it is marked as abstract.

The Apache syntax would simply be:

	RewriteCond %{HTTP_USER_AGENT} "=blackboardally"
	RewriteRule ^ - [F]

Am I missing a way to do this with jetty rewrite? Or is there an alternative module/mechanism that could accomplish this?

Thanks much…


Back to the top