Skip to content

A simple Falcon module for Cross-Origin Resource Sharing (CORS)

License

Notifications You must be signed in to change notification settings

alexferl/falcon-crossorigin

Repository files navigation

falcon-crossorigin codecov

A simple Falcon module for Cross-Origin Resource Sharing (CORS).

Install

pip install falcon-crossorigin

Usage

import falcon
from falcon_crossorigin import CrossOrigin

cross_origin = CrossOrigin(
    allow_origins="https://app.example.com",
    allow_methods="GET,POST",
    allow_headers="Pragma,Expires,Cache-Control",
    allow_credentials=True,
    expose_headers="Link",
    max_age=3600,
)

api = falcon.API(middleware=[cross_origin])

Credits

Port of Echo's CORS middleware.