Frage

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?

War es hilfreich?

Lösung

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']  = '*'
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top