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 auth.permissions import AdministerOrganizationPermission
|
||||||
from util.invoice import renderInvoiceToPdf
|
from util.invoice import renderInvoiceToPdf
|
||||||
from util.seo import render_snapshot
|
from util.seo import render_snapshot
|
||||||
|
from util.cache import no_cache
|
||||||
from endpoints.api import get_route_data
|
from endpoints.api import get_route_data
|
||||||
from endpoints.common import common_login
|
from endpoints.common import common_login
|
||||||
|
|
||||||
|
@ -20,12 +21,13 @@ logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def render_page_template(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('/', methods=['GET'], defaults={'path': ''})
|
||||||
@app.route('/repository/<path:path>', methods=['GET'])
|
@app.route('/repository/<path:path>', methods=['GET'])
|
||||||
@app.route('/organization/<path:path>', methods=['GET'])
|
@app.route('/organization/<path:path>', methods=['GET'])
|
||||||
|
@no_cache
|
||||||
def index(path):
|
def index(path):
|
||||||
return render_page_template('index.html')
|
return render_page_template('index.html')
|
||||||
|
|
||||||
|
@ -44,68 +46,81 @@ def snapshot(path = ''):
|
||||||
|
|
||||||
|
|
||||||
@app.route('/plans/')
|
@app.route('/plans/')
|
||||||
|
@no_cache
|
||||||
def plans():
|
def plans():
|
||||||
return index('')
|
return index('')
|
||||||
|
|
||||||
|
|
||||||
@app.route('/guide/')
|
@app.route('/guide/')
|
||||||
|
@no_cache
|
||||||
def guide():
|
def guide():
|
||||||
return index('')
|
return index('')
|
||||||
|
|
||||||
|
|
||||||
@app.route('/organizations/')
|
@app.route('/organizations/')
|
||||||
@app.route('/organizations/new/')
|
@app.route('/organizations/new/')
|
||||||
|
@no_cache
|
||||||
def organizations():
|
def organizations():
|
||||||
return index('')
|
return index('')
|
||||||
|
|
||||||
|
|
||||||
@app.route('/user/')
|
@app.route('/user/')
|
||||||
|
@no_cache
|
||||||
def user():
|
def user():
|
||||||
return index('')
|
return index('')
|
||||||
|
|
||||||
|
|
||||||
@app.route('/signin/')
|
@app.route('/signin/')
|
||||||
|
@no_cache
|
||||||
def signin():
|
def signin():
|
||||||
return index('')
|
return index('')
|
||||||
|
|
||||||
|
|
||||||
@app.route('/new/')
|
@app.route('/new/')
|
||||||
|
@no_cache
|
||||||
def new():
|
def new():
|
||||||
return index('')
|
return index('')
|
||||||
|
|
||||||
|
|
||||||
@app.route('/repository/')
|
@app.route('/repository/')
|
||||||
|
@no_cache
|
||||||
def repository():
|
def repository():
|
||||||
return index('')
|
return index('')
|
||||||
|
|
||||||
|
|
||||||
@app.route('/security/')
|
@app.route('/security/')
|
||||||
|
@no_cache
|
||||||
def security():
|
def security():
|
||||||
return index('')
|
return index('')
|
||||||
|
|
||||||
|
|
||||||
@app.route('/v1')
|
@app.route('/v1')
|
||||||
@app.route('/v1/')
|
@app.route('/v1/')
|
||||||
|
@no_cache
|
||||||
def v1():
|
def v1():
|
||||||
return index('')
|
return index('')
|
||||||
|
|
||||||
|
|
||||||
@app.route('/status', methods=['GET'])
|
@app.route('/status', methods=['GET'])
|
||||||
|
@no_cache
|
||||||
def status():
|
def status():
|
||||||
return make_response('Healthy')
|
return make_response('Healthy')
|
||||||
|
|
||||||
|
|
||||||
@app.route('/tos', methods=['GET'])
|
@app.route('/tos', methods=['GET'])
|
||||||
|
@no_cache
|
||||||
def tos():
|
def tos():
|
||||||
return render_page_template('tos.html')
|
return render_page_template('tos.html')
|
||||||
|
|
||||||
|
|
||||||
@app.route('/disclaimer', methods=['GET'])
|
@app.route('/disclaimer', methods=['GET'])
|
||||||
|
@no_cache
|
||||||
def disclaimer():
|
def disclaimer():
|
||||||
return render_page_template('disclaimer.html')
|
return render_page_template('disclaimer.html')
|
||||||
|
|
||||||
|
|
||||||
@app.route('/privacy', methods=['GET'])
|
@app.route('/privacy', methods=['GET'])
|
||||||
|
@no_cache
|
||||||
def privacy():
|
def privacy():
|
||||||
return render_page_template('privacy.html')
|
return render_page_template('privacy.html')
|
||||||
|
|
||||||
|
@ -227,8 +242,3 @@ def confirm_recovery():
|
||||||
return redirect(url_for('user'))
|
return redirect(url_for('user'))
|
||||||
else:
|
else:
|
||||||
abort(403)
|
abort(403)
|
||||||
|
|
||||||
|
|
||||||
@app.route('/reset', methods=['GET'])
|
|
||||||
def password_reset():
|
|
||||||
pass
|
|
||||||
|
|
|
@ -10,3 +10,12 @@ def cache_control(max_age=55):
|
||||||
return response
|
return response
|
||||||
return add_max_age
|
return add_max_age
|
||||||
return wrap
|
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