mirror of
https://github.com/mynodebtc/mynode.git
synced 2024-12-25 14:08:07 +00:00
Use temporary redirects for HTTPS to prevent caching
This commit is contained in:
parent
2bda1eca18
commit
8a1dbd6398
|
@ -847,12 +847,17 @@ def before_request():
|
|||
if is_https_forced():
|
||||
if not request.is_secure:
|
||||
url = request.url.replace('http://', 'https://', 1)
|
||||
code = 301
|
||||
code = 302
|
||||
app.logger.info("Redirecting to HTTPS ({})".format(url))
|
||||
return redirect(url, code=code)
|
||||
|
||||
# Disable browser caching
|
||||
@app.after_request
|
||||
def set_response_headers(response):
|
||||
# Prevents 301 from saving forever
|
||||
response.headers['Cache-Control'] = 'no-store'
|
||||
|
||||
# No Caching
|
||||
#response.headers['Cache-Control'] = 'no-cache, no-store, must-revalidate'
|
||||
#response.headers['Pragma'] = 'no-cache'
|
||||
#response.headers['Expires'] = '0'
|
||||
|
|
Loading…
Reference in New Issue
Block a user