Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Martin
ip-info
Commits
dbaaa45a
Commit
dbaaa45a
authored
8 years ago
by
Martin
Browse files
Options
Download
Email Patches
Plain Diff
added filter for proxy forwarding
parent
77a57c43
master
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ipinfo/tools.py
+8
-1
ipinfo/tools.py
with
8 additions
and
1 deletion
+8
-1
ipinfo/tools.py
View file @
dbaaa45a
...
...
@@ -8,12 +8,19 @@ from collections import OrderedDict
import
json
import
settings
def
get_ip
(
request
):
"""
gets an ip address, based on a request.
Filters for reverse proxies
"""
return
request
.
remote_addr
# taken from http://stackoverflow.com/a/22936947
route
=
request
.
access_route
+
[
request
.
remote_addr
]
return
next
((
addr
for
addr
in
reversed
(
route
)
if
addr
not
in
settings
.
TRUSTED_PROXIES
),
request
.
remote_addr
)
def
guess_format
(
request
):
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help