Wednesday, September 28, 2011

Using IGNORABLE_404_URLS

Our Django sites get literally hundreds of bogus 404 requests per day. For example:

Referrer: http://domain.edu/
Requested URL: /signup/
User agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1;)
IP address: 168.9.86.2

The "referrer" line is a lie because nowhere on our site do we point to "/signup" . I've given up trying to figure out how these things are generated or how to block them. But I would like to limit the number of daily emails to just the actual/legit 404s. So I started using IGNORABLE_404_URLS, per:

https://docs.djangoproject.com/en/dev/howto/error-reporting/#errors

IGNORABLE_404_URLS = (
   re.compile(r'\.(php|cgi)$'),
    re.compile(r'^/forums'),
    re.compile(r'^/signup'),
    re.compile(r'/src/'),    
    re.compile(r'/pdf/'),        
)

Unfortunately this seems to have no effect. Shouldn't the regex pattern there catch the bogus request domain.edu/signup ? Or is this not working because the way the requests are being submitted somehow bypasses Django's ability to catch it as an error? I'm just not clear what's going on here.

Thanks.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/7xxDzuRZue4J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment