Infinity_dev
Infinity_dev

Reputation: 199

How to get Client IP with ktor

Hey i tried to get the ip of the client with ktor.

I used the method

this.context.request.local.remoteHost

(this.context is an Instance of ApplicationCall)

How can i get the real ip an not something like "********.dip0.t-ipconnect.de"

Upvotes: 10

Views: 4764

Answers (1)

Aleksei Tirman
Aleksei Tirman

Reputation: 6999

You can also get a remote host from the request's origin: call.request.origin.remoteHost, but it returns the IP address in not every case either.

To get the IP address use the call.request.origin.remoteAddress property.

Upvotes: 12

Related Questions