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?

有帮助吗?

解决方案

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']  = '*'
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top