Skip to content

Instantly share code, notes, and snippets.

@decklord
decklord / django-crossdomainxhr-middleware.py
Last active August 29, 2015 13:57 — forked from valsteen/django-crossdomainxhr-middleware.py
Enables to do cross domain requests with django
from django import http
from django.conf import settings
class XsSharingMiddleware(object):
"""
This middleware allows cross-domain XHR using the html5 postMessage API.
Access-Control-Allow-Origin: http://foo.example
Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE
"""