Add no-cache as a response header.
This commit is contained in:
parent
8342dfcccf
commit
8e4bbdf1dd
2 changed files with 25 additions and 6 deletions
|
@ -12,6 +12,7 @@ from app import app, mixpanel
|
|||
from auth.permissions import AdministerOrganizationPermission
|
||||
from util.invoice import renderInvoiceToPdf
|
||||
from util.seo import render_snapshot
|
||||
from util.cache import no_cache
|
||||
from endpoints.api import get_route_data
|
||||
from endpoints.common import common_login
|
||||
|
||||
|
@ -20,12 +21,13 @@ logger = logging.getLogger(__name__)
|
|||
|
||||
|
||||
def render_page_template(name):
|
||||
return render_template(name, route_data = get_route_data())
|
||||
return make_response(render_template(name, route_data=get_route_data()))
|
||||
|
||||
|
||||
@app.route('/', methods=['GET'], defaults={'path': ''})
|
||||
@app.route('/repository/<path:path>', methods=['GET'])
|
||||
@app.route('/organization/<path:path>', methods=['GET'])
|
||||
@no_cache
|
||||
def index(path):
|
||||
return render_page_template('index.html')
|
||||
|
||||
|
@ -44,68 +46,81 @@ def snapshot(path = ''):
|
|||
|
||||
|
||||
@app.route('/plans/')
|
||||
@no_cache
|
||||
def plans():
|
||||
return index('')
|
||||
|
||||
|
||||
@app.route('/guide/')
|
||||
@no_cache
|
||||
def guide():
|
||||
return index('')
|
||||
|
||||
|
||||
@app.route('/organizations/')
|
||||
@app.route('/organizations/new/')
|
||||
@no_cache
|
||||
def organizations():
|
||||
return index('')
|
||||
|
||||
|
||||
@app.route('/user/')
|
||||
@no_cache
|
||||
def user():
|
||||
return index('')
|
||||
|
||||
|
||||
@app.route('/signin/')
|
||||
@no_cache
|
||||
def signin():
|
||||
return index('')
|
||||
|
||||
|
||||
@app.route('/new/')
|
||||
@no_cache
|
||||
def new():
|
||||
return index('')
|
||||
|
||||
|
||||
@app.route('/repository/')
|
||||
@no_cache
|
||||
def repository():
|
||||
return index('')
|
||||
|
||||
|
||||
@app.route('/security/')
|
||||
@no_cache
|
||||
def security():
|
||||
return index('')
|
||||
|
||||
|
||||
@app.route('/v1')
|
||||
@app.route('/v1/')
|
||||
@no_cache
|
||||
def v1():
|
||||
return index('')
|
||||
|
||||
|
||||
@app.route('/status', methods=['GET'])
|
||||
@no_cache
|
||||
def status():
|
||||
return make_response('Healthy')
|
||||
|
||||
|
||||
@app.route('/tos', methods=['GET'])
|
||||
@no_cache
|
||||
def tos():
|
||||
return render_page_template('tos.html')
|
||||
|
||||
|
||||
@app.route('/disclaimer', methods=['GET'])
|
||||
@no_cache
|
||||
def disclaimer():
|
||||
return render_page_template('disclaimer.html')
|
||||
|
||||
|
||||
@app.route('/privacy', methods=['GET'])
|
||||
@no_cache
|
||||
def privacy():
|
||||
return render_page_template('privacy.html')
|
||||
|
||||
|
@ -227,8 +242,3 @@ def confirm_recovery():
|
|||
return redirect(url_for('user'))
|
||||
else:
|
||||
abort(403)
|
||||
|
||||
|
||||
@app.route('/reset', methods=['GET'])
|
||||
def password_reset():
|
||||
pass
|
||||
|
|
|
@ -10,3 +10,12 @@ def cache_control(max_age=55):
|
|||
return response
|
||||
return add_max_age
|
||||
return wrap
|
||||
|
||||
|
||||
def no_cache(f):
|
||||
@wraps(f)
|
||||
def add_no_cache(*args, **kwargs):
|
||||
response = f(*args, **kwargs)
|
||||
response.headers['Cache-Control'] = 'no-cache'
|
||||
return response
|
||||
return add_no_cache
|
||||
|
|
Reference in a new issue