Skip to content

Commit 76dd050

Browse files
make it actually work
1 parent c1a89b1 commit 76dd050

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

app.py

+15-2
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,24 @@
55

66
@app.route('/')
77
def ip(): # put application's code here
8-
if flask.request.remote_addr == '127.0.0.1':
8+
if flask.request.environ.get('HTTP_X_REAL_IP') is not None:
99
IP = flask.request.environ.get('HTTP_X_REAL_IP', flask.request.remote_addr)
1010
else:
1111
IP = flask.request.remote_addr
12-
return IP
12+
return f"""<title>Your IP is {IP}</title><h1
13+
id="age"
14+
style="
15+
font-size: 32px;
16+
font-size: 3vw;
17+
height: 100%;
18+
width: 100%;
19+
display: flex;
20+
position: fixed;
21+
align-items: center;
22+
justify-content: center;
23+
"
24+
>Your public IP is {IP}
25+
</h1>"""
1326

1427

1528
if __name__ == '__main__':

0 commit comments

Comments
 (0)