adamchainz / django-cors-headers

Django app for handling the server headers required for Cross-Origin Resource Sharing (CORS)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

django-cors-headers not compatible with django restframework >3.9.0

kenware opened this issue · comments

commented

django-cors-headers does not seem to work with django restframework version 3.9.4. When I downgraded to version 3.9.0, It works fine

Please give a more complete bug report -how is it not working? You're not seeing the headers? And I feel like this should be reported on DRF more than here, since you found the fix is downgrading DRF.

Can you explain in detail what does not seem to work?

commented

It does not break the application but it was not returning Access-Control-Allow-Origin':'*. The browser complains about cors. When I downgraded the DRF to 3.9.0, it works fine

Please try creating a mini application that reproduces the issue. I created a mini app with DRF and Django in a single file in https://github.com/adamchainz/test-scout-issue-213/blob/master/manage.py recently that may be of use.

Just in case it might help as I've spend some time trying to get it to work and thinking there might be a bug.

  • Try clearing your browser cache or use a browser you didn't use before for a quick test.

Chances are you used the front end page before adding django-cors-headers to your project.
After adding it to my project, my response headers were still lacking Access-Control-Allow-Origin, until I cleared the browser cache. After that it was just fine.

@kenware I'm closing this issue right now because there's no reproducing case, but if you provide one I'll re-open and investigate.

Thanks,

Adam