Skip to content

Instantly share code, notes, and snippets.

@hsparikh
hsparikh / django-crossdomainxhr-middleware.py
Created October 13, 2012 05:13
Middlware to allow's your django server to respond appropriately to cross domain XHR (postMessage html5 API).
import re
from django.utils.text import compress_string
from django.utils.cache import patch_vary_headers
from django import http
try:
import settings
XS_SHARING_ALLOWED_ORIGINS = settings.XS_SHARING_ALLOWED_ORIGINS