Description
Forward the request information of Ktor to the Acceptor#accept method so we can see the request headers, IP, and other request details.
Motivation
Determining the IP of the client is impossible now. You can make some hacks to determine it with some degree of certainty but it's not enough. Having access to the ApplicationRequest allows us to access the origin IP and the headers (in case we are behind load balancers).
Desired solution
Forward the ApplicationRequest of Ktor to the Acceptor#accept method.
Considered alternatives
-
Have a special kind of Acceptor that we can use with Ktor HTTP and WebSockets.
-
Forward the IP (but this is hard because of load balancers and proxies, usually needs to be done by a higher level with knowledge about the node architecture (eg: number of trusted proxies for x-forwarded-for)).
-
Pass a "requestContext" map to the acceptor where we can store values regarding the request. Add a callback to Route.RSocket where we get the application context and we can build it.