문제

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