Skip to content Skip to sidebar Skip to footer

Same Origin Policy Violated On Localhost With Falcon Webserver

I am running an elm frontend via elm-reactor on localhost:8000. It is supposed to load json files from a falcon backend running via gunicorn on localhost:8010. This fails. The fron

Solution 1:

Try this. Hopefully, this will solve your problem.

import falcon
from falcon_cors import CORS
cors = CORS(allow_origins_list=['http://localhost:8080', 'http://localhost:8000', 'http://localhost:8010'], allow_all_headers=True, allow_methods_list=['GET', 'POST', 'OPTIONS'])
api = falcon.API(middleware=[cors.middleware])

Solution 2:

It turns out that falcon_cors offers allow_all_origins=True as a parameter. This fixes my problem, but isn't a perfect solution.

When using POST requests as well allow_all_methods=True should be set as well.

Post a Comment for "Same Origin Policy Violated On Localhost With Falcon Webserver"