aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Stack <bgstack15@gmail.com>2022-02-16 17:00:28 -0500
committerB. Stack <bgstack15@gmail.com>2022-02-16 17:00:28 -0500
commitb75a1c92d160bc9ad97b5a2ba96a8af8216579de (patch)
tree7befc2113ef03c769b57da5a6d043edbe032e674
parenthandle dir name in spec better (diff)
downloadstackbin-b75a1c92d160bc9ad97b5a2ba96a8af8216579de.tar.gz
stackbin-b75a1c92d160bc9ad97b5a2ba96a8af8216579de.tar.bz2
stackbin-b75a1c92d160bc9ad97b5a2ba96a8af8216579de.zip
handle /set better
-rw-r--r--stackbin.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/stackbin.py b/stackbin.py
index 89ec493..2345d5f 100644
--- a/stackbin.py
+++ b/stackbin.py
@@ -316,11 +316,14 @@ def favicon():
@app.route('/set')
def get_proxied_path():
+ prefix = "/"
if 'HTTP_X_FORWARDED_PREFIX' in request.environ:
pl = len(dict(request.headers)["X-Forwarded-Host"].split(", "))
- #prefix = request.environ['HTTP_X_FORWARDED_PREFIX']
+ prefix = request.environ['HTTP_X_FORWARDED_PREFIX']
app.wsgi_app = ProxyFix(app.wsgi_app,x_for=pl,x_host=pl,x_port=pl,x_prefix=pl,x_proto=pl)
- return redirect(url_for('new_paste'))
+ # we can afford to use prefix because new_paste is the top-level endpoint of the whole app
+ message = refresh_string(1, prefix) + "OK"
+ return message, 200
# stubs, to simplify any templates that ask url_for("login")
@app.route('/login/')
bgstack15