Skip to content

Commit

Permalink
Fix IP address when app is behind Application LB
Browse files Browse the repository at this point in the history
  • Loading branch information
pnedkov committed Dec 29, 2023
1 parent 0c46df0 commit e3456c7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ipget/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.2
0.0.3
2 changes: 1 addition & 1 deletion ipget/ipget.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def home():
client_info = {
"ip": client_ip,
"remote_hostname": urlparse("//" + str(request.headers.get("Host"))).netloc,
"x_forwarded_for": request.headers.get("X-Forwarded-For"),
"xff": request.headers.get("X-Forwarded-For"),
"country": get_country(client_ip),
"user_agent": request.user_agent.string,
"headers": format_headers(request.headers),
Expand Down
4 changes: 2 additions & 2 deletions ipget/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
<tr>
<td>curl {{ client_info.remote_hostname }}<br>curl {{ client_info.remote_hostname }}/ip</td>
<td>IP Address</td>
<td><p>{{ client_info.ip }}</p></td>
<td><p>{{ client_info.xff if client_info.xff else client_info.ip }}</p></td>
</tr>
<tr>
<td>curl {{ client_info.remote_hostname }}/xff</td>
<td>X-Forwarded-For</td>
<td>{{ client_info.x_forwarded_for }}</td>
<td>{{ client_info.xff }}</td>
</tr>
{% if ip_api %}
<tr>
Expand Down

0 comments on commit e3456c7

Please sign in to comment.