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

CORS_ORIGIN_REGEX_WHITELIST is missing scheme or netloc

T-101 opened this issue · comments

commented

django-cors-headers==3.2.1

settings.py:

CORS_ORIGIN_REGEX_WHITELIST = [
    r"http://(?:(?:127|0)\.0\.0\.(?:0|1)|localhost):3000",
]

console:

ERRORS:
?: (corsheaders.E013) Origin '0.0.0.0:3000' in CORS_ORIGIN_WHITELIST is missing  scheme or netloc
	HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com).
?: (corsheaders.E013) Origin '127.0.0.1:3000' in CORS_ORIGIN_WHITELIST is missing  scheme or netloc
	HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com).
?: (corsheaders.E013) Origin 'localhost:3000' in CORS_ORIGIN_WHITELIST is missing  scheme or netloc
	HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com).

I also tried with regex capturing groups and escaping the //, but the results stay the same

You pasted the CORS_ORIGIN_WHITELIST setting but the warning is about the non regex settingCORS_ORIGIN_WHITELIST. Look in CORS_ORIGIN_WHITELIST and you'll find the answer.

commented

Gah! So stupid of me. I had the settings already in place earlier in settings.py. Sorry about this nonsense, thank you for this brilliant package and have a nice day :)