Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When trying set corsheaders in settings.py file

(corsheaders.E014) Origin 'http://localhost:4200/' in CORS_ORIGIN_WHITELIST should not have path .Im getting this error.

CORS_ORIGIN_WHITELIST = ( 'http://localhost:4200/', )

Origin 'http://localhost:4200/' in CORS_ORIGIN_WHITELIST should not have path .Im getting this error.

like image 521
Srisainath Jilakara Avatar asked Jun 01 '19 08:06

Srisainath Jilakara


People also ask

What is Corsheaders Django?

django-cors-headers is a Django application for handling the server headers required for Cross-Origin Resource Sharing (CORS).

What is Cors_allowed_origins?

CORS_ALLOWED_ORIGINS is the list of origins authorized to make requests. For example, below I've specified four origins: Django. CORS_ALLOWED_ORIGINS = [ "https://domain.com", "https://api.domain.com", "http://localhost:8080", "http://127.0.0.1:9000" ]


1 Answers

Remove the slash (/) from the end of the line (after the number 4200), leaving it as:

CORS_ORIGIN_WHITELIST = ( 'http://localhost:4200', )

That should make it work.

like image 167
Vemka Avatar answered Oct 04 '22 18:10

Vemka