djblets.http.requests¶
Utilities for working with HTTP requests.
New in version 6.0.
- get_http_request_ip(request: HttpRequest) str[source]¶
Return the IP address from a client for a given HTTP request.
This will check the following headers for a suitable IP address:
X-Real-IP
X-Forwarded-For
If not found, it will fall back to the IP address the request originated from, which may be a public address or an internal address within the service’s network.
New in version 6.0.
- Parameters:
request (
django.http.HttpRequest) – The HTTP request from the client.- Returns:
The IP address for the request.
- Return type: