-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Closed
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancementA general enhancement
Milestone
Description
Hello,
is there any way how to obtain localAddr from incoming request? I mean if I have multiple virtual addresses/interfaces on host and I need to distinguish on which address was the request accepted.
Only way which I found now is little hack with netty's HttpServerRequest.
if ((((AbstractServerHttpRequest) exchange.getRequest()).getNativeRequest()) instanceof HttpServerRequest) {
final InetSocketAddress localAddress = ((HttpServerRequest) (((AbstractServerHttpRequest) exchange.getRequest()).getNativeRequest())).hostAddress();
logger.debug("!!! Hostname {}, HostString {}, Address {}",
localAddress.getHostName(),
localAddress.getHostString(),
localAddress.getAddress()
);
}
Is there any general approach?
Thanks
Metadata
Metadata
Assignees
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancementA general enhancement