From 91094cf65958c66189e654e83bf839edd35a5350 Mon Sep 17 00:00:00 2001 From: Soam Vasani Date: Tue, 30 Jan 2018 12:00:30 -0800 Subject: [PATCH] Fix broken redirect (#467) By default, flask turns redirects into absolute URLs. This is undesired behaviour on Kubernetes, because the Pod's own IP address is not really useful to any client that's not in the cluster (and even within the cluster most clients will want to use the address of a Service, not a Pod). --- examples/python/guestbook/add.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/python/guestbook/add.py b/examples/python/guestbook/add.py index 5e923457..f7a747ae 100644 --- a/examples/python/guestbook/add.py +++ b/examples/python/guestbook/add.py @@ -13,4 +13,6 @@ def main(): # back to the list item = request.form['text'] redisConnection.rpush('guestbook', item) - return redirect('/guestbook', code=303) + r = redirect('/guestbook', code=303) + r.autocorrect_location_header = False + return r