In my flask application, I need to set Access-Control-Max-Age
. What is the correct syntax for it?
from flask import Flask, send_from_directory
from flask_cors import CORS, cross_origin
app = Flask(__name__,static_folder='./build')
CORS(app)
reference: https://flask-cors.readthedocs.io/en/latest/api.html
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)