I see we are missing docs for this.
The client IP header needs an opt in to be available (as it has a slight performance overhead for each request). For the JVM SDK that is done by adding x-forwarded-for
to the forwardedHeaders
for the component(s) where you need it.
The API for doing that is a bit cumbersome though, you will need to drop down to calling Kalix#register
yourself instead of using the generated KalixFactory
, something like this (in Scala, Java should look roughly but not exactly the same):
def main(args: Array[String]): Unit = {
val kalix = Kalix()
.register(
MyActionProvider(
MyAction(_),
ActionOptions.defaults.withForwardHeaders(Set("x-forwarded-for"))
)
)
kalix.start()
}