CORS

Configure CORS

Cors is built in by default in all Ask apps. You can also configure CORS to e.g. only allow specific origins or only enable CORS on specific routes.

Configuring CORS

CORS can be configured in your projects Askfile. Configuration options are added in the [cors] section.

The configuration options supported are the same as Flask-Cors supports. Flask-Cors documentation: https://flask-cors.corydolphin.com/en/latest/api.html

Example

Askfile.toml
[cors]
origins = ['https://example.com', 'http://localhost:8080']
methods = ['GET', 'PUT']
resources = [r'/api/*']

Last updated