On 25/09/2020 06.10, Stats Student wrote:
> You can read the client's IP address with -
>
> request.META['REMOTE_ADDR'] -- ( not sure how it handles proxies, etc )
>
Proxies should set the X-Forwarded-For header:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For
the value of which will then be used in the META dictionary.
Worth noticing that it's trivially possible for any client to set that
header as well and there's no way to reliably get the actual IP address
of the client simply because of how HTTP works.
Of course that's just a variation of "never trust the client" :-)
Kind regards,
Kasper Laudrup
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c5aedd33-9611-0624-2dd4-7d3589b03c7d%40stacktrace.dk.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment