django-cors-headers: CORS_ORIGIN_WHITELIST is missing scheme or netloc
CORS version: 3.0 OS: Ubuntu 16.04 LTS Django: 2.2.1
As soon as I started the server this error occurred:
django.core.management.base.SystemCheckError: SystemCheckError: System check identified some issues:
ERRORS:
?: (corsheaders.E013) Origin 'localhost:3000' in CORS_ORIGIN_WHITELIST is missing scheme or netloc
?: (corsheaders.E013) Origin 'localhost:8000' in CORS_ORIGIN_WHITELIST is missing scheme or netloc
?: (corsheaders.E013) Origin 'localhost:8080' in CORS_ORIGIN_WHITELIST is missing scheme or netloc
System check identified 3 issues (0 silenced).
My settings file contains the following settings:
CORS_ORIGIN_WHITELIST = (
'localhost:8000',
'localhost:3000',
'localhost:8080',
)
I’m using these exact settings in other apps with no issue on version 2.5.2. If I remove the items from this whitelist the errors go away.
Any insights appreciated. Thanks.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 6
- Comments: 15 (5 by maintainers)
Commits related to this issue
- Add a hint to the corsheaders.E013 check As suggested by @protosac in https://github.com/ottoyiu/django-cors-headers/issues/403#issuecomment-496333996 . — committed to adamchainz/django-cors-headers by adamchainz 5 years ago
- Add a hint to the corsheaders.E013 check (#417) As suggested by @protosac in https://github.com/ottoyiu/django-cors-headers/issues/403#issuecomment-496333996 . — committed to adamchainz/django-cors-headers by adamchainz 5 years ago
- Add a hint to the corsheaders.E013 check (#417) As suggested by @protosac in https://github.com/ottoyiu/django-cors-headers/issues/403#issuecomment-496333996 . — committed to adamchainz/django-cors-headers by adamchainz 5 years ago
- Add a hint to the corsheaders.E013 check As suggested by @protosac in https://github.com/ottoyiu/django-cors-headers/issues/403#issuecomment-496333996 . — committed to adamchainz/django-cors-headers by adamchainz 5 years ago
- Add a hint to the corsheaders.E013 check (#418) As suggested by @protosac in https://github.com/ottoyiu/django-cors-headers/issues/403#issuecomment-496333996 . — committed to adamchainz/django-cors-headers by adamchainz 5 years ago
- Add protocol to fix CORS issue https://github.com/ottoyiu/django-cors-headers/issues/403 — committed to higlass/higlass-server by flekschas 5 years ago
- Flekschas/pin versions fix cors issue (#107) * Pin version * Add protocol to fix CORS issue https://github.com/ottoyiu/django-cors-headers/issues/403 * Avoid issues with trailing commas and ... — committed to higlass/higlass-server by flekschas 5 years ago
I ran into this same issue, the errors go away with this:
I wrote a long changelog note about this: https://github.com/ottoyiu/django-cors-headers/blob/master/HISTORY.rst#300-2019-05-10 . Please refer to packages’ changelogs whenever you upgrade, and ensure you pin the versions you install in your
requirements.txt
.@subodhjena I’ve noticed a bug there, that
null
shouldn’t be caught by the check, issue #404 will fix that, and I’ll release version 3.0.1 doing so.@dopeboy I was facing the same errors list but these lines solved my problem– CORS_ORIGIN_WHITELIST = [ ‘http://localhost:3000’, ‘http://localhost:8000’, ‘http://localhost:8080’, ]
make sure you specify the protocol … so this 127.0.0.1:9000 becomes http://127.0.0.1:9000
I realized that changing from a tuple () to a list [] solved it for me.