From 76dd050cc5ab63fc69bd612fca88eb77d605c0fc Mon Sep 17 00:00:00 2001 From: Grant Hutchinson Date: Thu, 21 Oct 2021 22:25:03 -0600 Subject: [PATCH] make it actually work --- app.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index a2f5e61..e895d45 100644 --- a/app.py +++ b/app.py @@ -5,11 +5,24 @@ @app.route('/') def ip(): # put application's code here - if flask.request.remote_addr == '127.0.0.1': + if flask.request.environ.get('HTTP_X_REAL_IP') is not None: IP = flask.request.environ.get('HTTP_X_REAL_IP', flask.request.remote_addr) else: IP = flask.request.remote_addr - return IP + return f"""Your IP is {IP}

Your public IP is {IP} +

""" if __name__ == '__main__':