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 563853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:42:14+00:00 2026-05-13T12:42:14+00:00

How do I set a P3P compact privacy policy from Django so that IE

  • 0

How do I set a P3P compact privacy policy from Django so that IE accepts cookies from my site when the security settings are on HIGH – i.e. no cookies accepted unless there’s a Compact Privacy Policy.

Cheers
Guy

  • 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-05-13T12:42:14+00:00Added an answer on May 13, 2026 at 12:42 pm

    Middleware is the preferred way to do things like this on an “every request” basis. For instance, here is a simple bit of middleware to add the same (example) P3P header to every response Django generates:

    In settings.py:

    P3P_COMPACT = 'policyref="http://www.example.com/p3p.xml", CP="NON DSP COR CURa TIA"'
    MIDDLEWARE_CLASSES += ('myapp.middleware.P3PHeaderMiddleware',)
    

    In myapp/middleware.py:

    from django.conf import settings
    
    class P3PHeaderMiddleware(object):
        def process_response(self, request, response):
            response['P3P'] = getattr(settings, 'P3P_COMPACT', None)
            return response
    

    You could also get a similar effect in a single view by setting the P3P header in the response:

    def my_view(request):
        response = render_to_response('my_template.html')
        response['P3P'] = 'CP="NON DSP COR CURa TIA"'
        return response
    

    To expand on the topic a little bit, cookies and headers such as the P3P header are both sent at the same time, as part of the response; in fact, under the hood, cookies are set with another response header. You can see the cookie header using curl:

    $ curl --head http://www.google.com/
    HTTP/1.1 200 OK
    Date: Wed, 13 Jan 2010 00:04:59 GMT
    Expires: -1
    Cache-Control: private, max-age=0
    Content-Type: text/html; charset=ISO-8859-1
    Set-Cookie: PREF=ID=d2c09762c479f94e:TM=1263341099:LM=1263341099:S=oJby3NpU4RsRfuYa; expires=Fri, 13-Jan-2012 00:04:59 GMT; path=/; domain=.google.com
    Set-Cookie: NID=30=kdKrd5e-u6Xs7cUe3p4eaNDtv6SO88uBL5v6_M1XMTSRmkh7okxrWLOm-l_uZdN37PxQIe4dBlekFFVCpTFXGyIDlUrz1hEwhgVLvXfIik_VeVWGmWzKbA5qu_Zq0sOi; expires=Thu, 15-Jul-2010 00:04:59 GMT; path=/; domain=.google.com; HttpOnly
    Server: gws
    X-XSS-Protection: 0
    Transfer-Encoding: chunked
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Medium Security in IE8 states that third-party cookies that save information that can be
SET @v1 := SELECT COUNT(*) FROM user_rating; SELECT @v1 When I execute this query
I'm including a javascript file on my page that has a Set-Cookie header. However,
Set up your JavaFX project in NetBeans IDE as follows. From the File menu,
SET NOCOUNT ON stops the message that shows the count of the number of
Set up a facebook App pulling a site through a canvas iframe (nothing special).
SET @sql = 'Declare ChildTableMigrator CURSOR FOR select ['+@FieldName+'] , ['+@FieldName+'Alias] from [' +
Yeah, this ought to be fun. I'm working on a site that was built
set :locales, %w[en it] set :default_locale, 'it' set :locale_pattern, /^\/?(#{Regexp.union(settings.locales)})(\/.+)$/ helpers do def locale
set up my machine at work (WXP 32bit) and MercurialEclipse in Eclipse Helios from

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.