Solveddjango 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.

16 Answers

✔️Accepted Answer

I ran into this same issue, the errors go away with this:

CORS_ORIGIN_WHITELIST = [
    'http://localhost:3000',
    'http://localhost:8000',
    'http://localhost:8080',
]

Other Answers:

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