Skip to content

Commit

Permalink
make it actually work
Browse files Browse the repository at this point in the history
  • Loading branch information
randomairborne committed Oct 22, 2021
1 parent c1a89b1 commit 76dd050
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""<title>Your IP is {IP}</title><h1
id="age"
style="
font-size: 32px;
font-size: 3vw;
height: 100%;
width: 100%;
display: flex;
position: fixed;
align-items: center;
justify-content: center;
"
>Your public IP is {IP}
</h1>"""


if __name__ == '__main__':
Expand Down

0 comments on commit 76dd050

Please sign in to comment.