is there a way to get the ip from the request? I t...
# ktor
h
is there a way to get the ip from the request? I tried printing the headers, and I don't think any of these are the IP from the request
1
remoteHost
g
But be careful with remoteHost, it doesn’t respect x-forwarded-for and other proxy headers
d
unless you install https://ktor.io/servers/features/forward-headers.html there are
request.origin.remoteHost
(respecting X-forwarded when installed and provided headersr by the reverse proxy) and
request.local.remoteHost
(that exposes the reverse proxy ip)
g
Oh nice! I like that Ktor has such real-life features out of the box
👍 2
h
great! thanks guys
d
there are two pages for client and server, one for handling requests and other for generating responses. I’d suggest you for reference to just press “t” in any page of the documentation and type either “request” or “response” to reach to those pages quickly
👍 1