From 73a7920cc86f3da18e9a580074417e5e0ff9c38f Mon Sep 17 00:00:00 2001 From: Alok Saldanha Date: Thu, 12 Aug 2021 13:58:19 -0400 Subject: [PATCH] add back ip_address endpoint --- cellxgene_gateway/gateway.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/cellxgene_gateway/gateway.py b/cellxgene_gateway/gateway.py index bcb68bb..2bb9b3f 100644 --- a/cellxgene_gateway/gateway.py +++ b/cellxgene_gateway/gateway.py @@ -52,6 +52,14 @@ def _force_https(app): return wrapper +def set_no_cache(resp): + resp.headers["Cache-Control"] = "no-cache, no-store, must-revalidate" + resp.headers["Pragma"] = "no-cache" + resp.headers["Expires"] = "0" + resp.headers["Cache-Control"] = "public, max-age=0" + return resp + + app.wsgi_app = _force_https(app.wsgi_app) if ( env.proxy_fix_for > 0 @@ -157,10 +165,7 @@ def filecrawl(path=None): path=path, ) ) - resp.headers["Cache-Control"] = "no-cache, no-store, must-revalidate" - resp.headers["Pragma"] = "no-cache" - resp.headers["Expires"] = "0" - resp.headers["Cache-Control"] = "public, max-age=0" + set_no_cache(resp) return resp @@ -267,6 +272,12 @@ def do_terminate(path): return redirect(url_for("do_GET_status"), code=302) +@app.route("/metadata/ip_address", methods=["GET"]) +def ip_address(): + resp = make_response(env.ip) + return set_no_cache(resp) + + def launch(): env.validate() if not item_sources or not len(item_sources):