cors headers in django

31 views
Skip to first unread message

Rakhee Menon

unread,
Sep 20, 2017, 9:51:42 AM9/20/17
to Django users
Hello,
Please can anyone tell how to add CORS headers in  Django and where should I add it??
Thanks in Advance
capture30.png

"Александр Христюхин (roboslone)"

unread,
Sep 20, 2017, 1:00:09 PM9/20/17
to django...@googlegroups.com
Hi, take a look at this package: https://github.com/ottoyiu/django-cors-headers
README is pretty thorough.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/da6c7389-89d2-4426-92e2-0acea471281a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
<capture30.png>

Rakhee Menon

unread,
Sep 21, 2017, 4:55:15 AM9/21/17
to Django users
Hey!!Thanks...But I tried adding those in settings.py ....yet there is no effect... and i get this error at the front end
Please check the attached images.
Thanks. 
Capture32.PNG
capture31.png

Andréas Kühne

unread,
Sep 21, 2017, 7:42:09 AM9/21/17
to django...@googlegroups.com
Hi,

Did you add the plugin itself as well? Because it's not the only settings that are required, if you look at the code it also has middleware and other things.

Regards,

Andréas

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

Rakhee Menon

unread,
Sep 21, 2017, 8:52:00 AM9/21/17
to Django users

Hey,
Yes i have installed cors headers and added it in installed apps and in middleware

Melvyn Sopacua

unread,
Sep 21, 2017, 10:30:46 AM9/21/17
to django...@googlegroups.com
The only thing I can see that might be the error is
'http://127.0.0.1:4200' in CORS_ORIGIN_WHITELIST. It's requested with
'http://localhost:4200' as can be seen in the error message. If that's
simple string matching, OPTIONS request will fail.
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/87177918-1c8d-4a42-bceb-61de109a9dfa%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.



--
Melvyn Sopacua
Reply all
Reply to author
Forward
0 new messages