Skip to content
This repository was archived by the owner on Jul 29, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion icanhaz.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ def icanhazafunction():
result = json.dumps(dict(request.headers))
else:
# The request is for *.icanhazip.com or something we don't recognize
result = request.remote_addr
# This method should pull the correct hop even with load balancers in the way
# https://stackoverflow.com/questions/33818540/how-to-get-the-first-client-ip-from-x-forwarded-for-behind-nginx-gunicorn
result = request.access_route[0]
return Response("%s\n" % result, mimetype="text/plain", headers={'X-Your-Ip': request.remote_addr})


Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
flask
gunicorn