Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7839213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T15:22:27+00:00 2026-06-02T15:22:27+00:00

I have a Django web site with medium traffic (about 4000/5000 visits per day).

  • 0

I have a Django web site with medium traffic (about 4000/5000 visits per day). Today I configured the “LOGGING” option on settings.py to send an email with “Info” level, just check if everything was ok…

There was my surprise, I am getting the following error:
[Django] WARNING (EXTERNAL IP): Forbidden (CSRF cookie not set.)

No stack trace available

<WSGIRequest
path:/cadastro/usuario/,
GET:<QueryDict: {}>,
POST:<QueryDict: {**xxxxxxx (some varibles....) and**: u'csrfmiddlewaretoken': [u'4wqRKQXZsTmXJaOkCsGobWyG1rzihc8x'], }>,
COOKIES:{},
META:{'CONTENT_LENGTH': '381',
 'CONTENT_TYPE': 'application/x-www-form-urlencoded',
 'CSRF_COOKIE': 'qzc4i7JdHoQLJ8N5aI9MTlamOZMOKmP0',
 'DOCUMENT_ROOT': '/opt/nginx/html',
 'HTTP_ACCEPT': 'text/html, application/xhtml+xml, */*',
 'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
 'HTTP_ACCEPT_LANGUAGE': 'pt-BR',
 'HTTP_CACHE_CONTROL': 'no-cache',
 'HTTP_CONNECTION': 'Keep-Alive',
 'HTTP_CONTENT_LENGTH': '381',
 'HTTP_CONTENT_TYPE': 'application/x-www-form-urlencoded',
 'HTTP_HOST': 'xxxxxx',
 'HTTP_REFERER': 'http://xxxx/y/z',
 'HTTP_USER_AGENT': 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)',
 'PATH_INFO': u'/y/z',
 'QUERY_STRING': '',
 'REMOTE_ADDR': '187.27.35.123',
 'REMOTE_PORT': '54221',
 'REQUEST_METHOD': 'POST',
 'REQUEST_URI': 'y/z',
 'SCRIPT_NAME': u'',
 'SERVER_NAME': 'xxxxxxx',
 'SERVER_PORT': '80',
 'SERVER_PROTOCOL': 'HTTP/1.1',
 'uwsgi.version': '0.9.6.5',
 'wsgi.errors': <open file 'wsgi_input', mode 'w' at 0xa126338>,
 'wsgi.file_wrapper': <built-in function uwsgi_sendfile>,
 'wsgi.input': <open file 'wsgi_input', mode 'r' at 0xa126a70>,


 'wsgi.multiprocess': True,
 'wsgi.multithread': False,
 'wsgi.run_once': False,
 'wsgi.url_scheme': 'http',
 'wsgi.version': (1, 0)}>

I tried to reproduce this error, but I couldn´t. I test on Firefox and Chrome, cleaned all cookies… Everything is fine. But I am getting this error a dozen of time, always with different IP, so I suppose that it isn’t an attack… All my form has {% csrf_token %} and django.middleware.csrf.CsrfViewMiddleware is configured on MIDDLEWARE_CLASSES.

The log message above is very clear that CSRF_COOKIE isnt empty. I am using Django 1.4.

[UPDATED]
I Think that theses users dont have cookies enabled…
So… The problem is: How to use CSRF with users that don´t have cookies enabled?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T15:22:29+00:00Added an answer on June 2, 2026 at 3:22 pm

    As I had mentioned in my main comment, you will see that error when a 403 is raised because of a CSRF failure.

    You should not need to worry about trying to handle CSRF protection against users without cookies enabled. The very nature of a CSRF attack requires the use of browser cookies. If they are not used, the CSRF-protected request will fail (as you have seen). Thus, you are still protected.

    Django lets you set a specific view to use for the client in the event of a CSRF failure: https://docs.djangoproject.com/en/dev/ref/settings/#std%3asetting-CSRF_FAILURE_VIEW

    Really, you should not need to do anything other than note that there are requests that are trying to POST to your server in an invalid way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have Django web-site working on tornado and nginx. I took this tornado launcher
I have a Django Web site where I'm using the oauth2app library for OAuth
I started working on Django 1.0 Web Site Development and have gotten my server
I have a web site running on Django and MySql. Part of the db
I have put my Django web site up to my web server and have
I have a web site on Django. I want to create a search input
I have a Django webapp that has both a front-end, web-accessible component and an
I'm new to Django and Web programming in general. Have googled but could not
I have recently started experimenting with Django for some web applications in my spare
I have java sdk 1.7. I've always used django/python for web development, this will

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.