Question

I'm using django-crossdomainxhr-middleware to allow CORS for my site, but I'm interested in only allowing 3 urls of my site.

How could I make this?

Was it helpful?

Solution

Adding this code did the trick:

url1 = '/Custom/url1/'
url2 = '/Custom/url2/'
if request.META['PATH_INFO'] == url1 or request.META['PATH_INFO'] == url2:
  response['Access-Control-Allow-Origin']  = '*'
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top