How to set Access-Control-Max-Age for flask_cors? How to set Access-Control-Max-Age for flask_cors? flask flask

How to set Access-Control-Max-Age for flask_cors?


Take a look at flask_cors.CORS section, the max_age part.

max_age (timedelta, integer, string or None)

The maximum time for which this CORS request maybe cached. This value is set as the Access-Control-Max-Age header.

According to the docs, you may need to init your CORS with this parameter.

CORS(app, max_age=3600)