Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/alexferl/falcon-crossorigin

A simple Falcon module for Cross-Origin Resource Sharing (CORS)
https://github.com/alexferl/falcon-crossorigin

cors cors-enabled falcon falcon-cors falcon-framework falcon-middleware python-falcon

Last synced: 3 months ago
JSON representation

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

Awesome Lists containing this project

README

        

# falcon-crossorigin [![codecov](https://codecov.io/gh/alexferl/falcon-crossorigin/branch/master/graph/badge.svg)](https://codecov.io/gh/alexferl/falcon-crossorigin)

A simple [Falcon](https://github.com/falconry/falcon) module for Cross-Origin Resource Sharing (CORS).

## Install
```shell script
pip install falcon-crossorigin
```

## Usage
```python
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](https://github.com/labstack/echo) [CORS middleware](https://github.com/labstack/echo/blob/1f6cc362cc91b22e5889b2674e45cf3545d6ee21/middleware/cors.go).