Skip to content
This repository has been archived by the owner on Sep 27, 2022. It is now read-only.

Cross-Origin Request Blocked #28

Open
cnstlungu opened this issue Sep 1, 2019 · 0 comments
Open

Cross-Origin Request Blocked #28

cnstlungu opened this issue Sep 1, 2019 · 0 comments

Comments

@cnstlungu
Copy link

cnstlungu commented Sep 1, 2019

Hi everyone.
I understand I'm doing something wrong, but I'm having trouble with setting up a Flask backend + Vue.js frontend.

I've added the Vue origins (port 8080) to CORS_ORIGIN_WHITELIST in settings.py, and was able to sign up and sign in. The problem occurs when I'm trying to add a new article.

I'm getting hit by the following error in the browser

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:5000/api/articles. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

I've seen a couple of suggestions online (such a browser addon to bypass this), but would really appreciate if anyone knows the proper way to do this.

Regards

    CORS_ORIGIN_WHITELIST = [
        'http://0.0.0.0:4100',
        'http://localhost:4100',
        'http://0.0.0.0:8000',
        'http://localhost:8000',
        'http://0.0.0.0:4200',
        'http://localhost:4200',
        'http://0.0.0.0:4000',
        'http://localhost:4000',
	'http://localhost:8080',
	'http://0.0.0.0:8080'
    ]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant