Wednesday, September 28, 2011

Re: Using IGNORABLE_404_URLS

Hey, I don't think I'll be able to help you much with figuring this out in Django-land. I do have one suggestion though. You could manually block these using your front-end server (Nginx, Apache, etc...) so that way it doesn't even reach Django. Not only would this be a hypothetically easy fix, you'd save yourself some server load as well.

On Wed, Sep 28, 2011 at 2:01 PM, shacker <shacker@birdhouse.org> wrote:

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.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
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