diff --git a/endpoints/web.py b/endpoints/web.py index 82ee2bc50..baca58a93 100644 --- a/endpoints/web.py +++ b/endpoints/web.py @@ -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/', methods=['GET']) @app.route('/organization/', 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 diff --git a/util/cache.py b/util/cache.py index 96160a71e..5ba0a7a34 100644 --- a/util/cache.py +++ b/util/cache.py @@ -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