'Missing scheme or netloc" for characters in a string
See original GitHub issue@dopeboy reports in https://github.com/ottoyiu/django-cors-headers/issues/403#issuecomment-494656909 :
I’m getting a bit of a strange error. This is with 3.0.1
This works fine locally:
CORS_ORIGIN_WHITELIST = ['localhost:3000']
But when on production, when I run a
manage.py
operation, I get:SystemCheckError: System check identified some issues: ERRORS: ?: (corsheaders.E013) Origin '/' in CORS_ORIGIN_WHITELIST is missing scheme or netloc ?: (corsheaders.E013) Origin '/' in CORS_ORIGIN_WHITELIST is missing scheme or netloc ?: (corsheaders.E013) Origin '0' in CORS_ORIGIN_WHITELIST is missing scheme or netloc ?: (corsheaders.E013) Origin '0' in CORS_ORIGIN_WHITELIST is missing scheme or netloc ?: (corsheaders.E013) Origin '0' in CORS_ORIGIN_WHITELIST is missing scheme or netloc ?: (corsheaders.E013) Origin '3' in CORS_ORIGIN_WHITELIST is missing scheme or netloc ?: (corsheaders.E013) Origin ':' in CORS_ORIGIN_WHITELIST is missing scheme or netloc ?: (corsheaders.E013) Origin ':' in CORS_ORIGIN_WHITELIST is missing scheme or netloc ?: (corsheaders.E013) Origin 'a' in CORS_ORIGIN_WHITELIST is missing scheme or netloc ?: (corsheaders.E013) Origin 'c' in CORS_ORIGIN_WHITELIST is missing scheme or netloc ?: (corsheaders.E013) Origin 'h' in CORS_ORIGIN_WHITELIST is missing scheme or netloc ?: (corsheaders.E013) Origin 'h' in CORS_ORIGIN_WHITELIST is missing scheme or netloc ?: (corsheaders.E013) Origin 'l' in CORS_ORIGIN_WHITELIST is missing scheme or netloc ?: (corsheaders.E013) Origin 'l' in CORS_ORIGIN_WHITELIST is missing scheme or netloc ?: (corsheaders.E013) Origin 'o' in CORS_ORIGIN_WHITELIST is missing scheme or netloc ?: (corsheaders.E013) Origin 'o' in CORS_ORIGIN_WHITELIST is missing scheme or netloc ?: (corsheaders.E013) Origin 'p' in CORS_ORIGIN_WHITELIST is missing scheme or netloc ?: (corsheaders.E013) Origin 's' in CORS_ORIGIN_WHITELIST is missing scheme or netloc ?: (corsheaders.E013) Origin 't' in CORS_ORIGIN_WHITELIST is missing scheme or netloc ?: (corsheaders.E013) Origin 't' in CORS_ORIGIN_WHITELIST is missing scheme or netloc ?: (corsheaders.E013) Origin 't' in CORS_ORIGIN_WHITELIST is missing scheme or netloc
This doesn’t work locally:
CORS_ORIGIN_WHITELIST = ['http://localhost:3000']
Issue Analytics
- State:
- Created 4 years ago
- Comments:18 (9 by maintainers)
Top Results From Across the Web
urlparse fails with simple url - python
According to https://www.rfc-editor.org/rfc/rfc1738#section-2.1: Scheme names consist of a sequence of characters. The lower case letters ...
Read more >urllib.parse — Parse URLs into components — Python 3.11.1 ...
This module defines a standard interface to break Uniform Resource Locator (URL) strings up in components (addressing scheme, network location, path etc.), to ......
Read more >utils/url.py · hemamaps/Scrapy
... (>63 characters) # or missing labels (e.g. http://.example.com) try: netloc ... if not for proper URL expected by remote website. try: scheme,...
Read more >Missing characters to make a string Pangram
Pangram is a sentence containing every letter in the English alphabet. Given a string, find all characters that are missing from the string, ......
Read more >urllib.parse — PyData Theme documentation
The empty string classifies URLs with no scheme specified, ... if not netloc or netloc.isascii(): return # looking for characters like \u2100 that...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just add
,
for host name tail inCORS_ORIGIN_WHITELIST
onsettings.py
like this
@adamchainz, thanks for being so diligent here. As someone who helps maintain another project, I know the effort that goes into monitoring these issues.
I completely rebuilt my pip library. My
pipfile.lock
is:Locally, I can confirm this doesn’t work (expected):
And this does work (expected):
I also tested on production with my URL and it works as expected - no longer getting those netloc errors. Not sure if there was something wrong with my pip install or if the new version fixed something but all is well for me. @SHxKM - want to try completely clearing your pip lib and reinstalling?
Thanks again for your support.