D
D
demortall2022-02-21 14:49:06
Flask
demortall, 2022-02-21 14:49:06

Flask session not working?

When it is launched locally, everything works, but when it is started on the server, sessions do not work,
I suspect that this is because of this code

app.secret_key = "b73e3d1f7d146fbe8b3169c8b73e3d1f7d146"
app.config['SESSION_TYPE'] = 'filesystem'
app.config['SESSION_COOKIE_SECURE'] = True
app.config['SESSION_COOKIE_SAMESITE'] = 'Lax'
app.config["REMEMBER_COOKIE_HTTPONLY"] = True

@app.after_request
def add_header(response):
    response.headers['Content-Security-Policy'] = config.csp
    response.headers['X-Content-Type-Options'] = 'nosniff'
    response.headers['X-Frame-Options'] = 'SAMEORIGIN'
    response.headers['X-XSS-Protection'] = '1; mode=block'
    return response

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question