src.api.entrypoints.extensions module

src.api.entrypoints.extensions.get_forwarded_address() str[source]

Retrieves the original IP address from the ‘X-Forwarded-For’ header of a HTTP request.

This is needed due to the way the app is deployed with Docker. If the ‘X-Forwarded-For’ header is not present, it falls back to the remote address of the request.

Parameters:

request (werkzeug.local.LocalProxy) – The HTTP request object.

Returns:

The original client IP address, or the remote address of the request if the

’X-Forwarded-For’ header is not present.

Return type:

str