This is a CORS algorithm and a falcon middleware for CORS.
Interface Documentation: https://falcon-cors.readthedocs.org/en/master/falcon_cors.html
pypi: https://pypi.python.org/pypi/falcon-cors
pip install falcon-cors
import falcon
from falcon_cors import CORS
cors = CORS(allow_origins_list=['http://test.com:8080'])
api = falcon.API(middleware=[cors.middleware])
import falcon
from falcon_cors import CORS
cors = CORS(allow_origins_list=['http://test.com:8080'])
api = falcon.API(middleware=[cors.middleware])
public_cors = CORS(allow_all_origins=True)
class MyPublicResource:
cors = public_cors
def on_post(self, req, resp):
resp.body = "Everone can post to this resource"
api.add_route("/public", MyPublicResource())
class MyResource:
cors_enabled = False
If you want to contribute just submit a PR and please make sure you have created some tests for your feature.