ilikerobots / cookiecutter-vue-django

Vue 3 + Vite + Django with no compromises. Use Vue SFCs directly in Django Templates, DRF not required.
BSD 3-Clause "New" or "Revised" License
208 stars 24 forks source link

[bug] CORS Error #22

Closed alvarolloret closed 3 years ago

alvarolloret commented 3 years ago

What happened?

No 'Access-Control-Allow-Origin' header is present on the requested resource.

What should've happened instead?

When loading fruits list allow to get the fruits using the REST view

Additional details

It seems CORS has not been implemented correctly, how should I proceed?

alvarolloret commented 3 years ago

It seems that CORS_URLS_REGEX does not work, however CORS_ORIGIN_ALLOW_ALL = True does the trick. If we want to be more restrictive we may just add: CORS_ORIGIN_WHITELIST = [ 'http://localhost:8080', 'http://127.0.0.1:8080', 'http://localhost:8000', 'http://127.0.0.1:8000', 'http://localhost:8001', 'http://127.0.0.1:8001', ]