diff --git a/core/src/main/scala/sttp/tapir/Tapir.scala b/core/src/main/scala/sttp/tapir/Tapir.scala index 3b4439c3ed..3366cb1b9a 100644 --- a/core/src/main/scala/sttp/tapir/Tapir.scala +++ b/core/src/main/scala/sttp/tapir/Tapir.scala @@ -480,7 +480,13 @@ trait TapirComputedInputs { this: Tapir => .flatMap(_.split(",").headOption) .orElse(request.header("Remote-Address")) .orElse(request.header("X-Real-Ip")) - .orElse(request.connectionInfo.remote.flatMap(a => Option(a.getAddress.getHostAddress))) + .orElse { + for { + r <- request.connectionInfo.remote + a <- Option(r.getAddress) + ha <- Option(a.getHostAddress) + } yield ha + } ) def isWebSocket: EndpointInput[Boolean] =