One of our experience API is being called by our multiple customer systems. We want to log the origin of the call with the caller host (domain) and IP address so that we know what was the origin of the request.
How do I capture the origin/host details?
I found the attributes.remoteAddress
gives the IP details only.
Internet communication is actually implemented using IP addresses. When you use a DNS name or a host name it is used as an alias for the IP address. You could try to use a reverse DNS lookup to find the DNS alias that matches an IP but that is not always possible, depending on how the DNS is configured. Mule HTTP Connector doesn't implement a reverse lookup feature. You would need to implement it yourself in Java and call it from your flow. See this answer https://stackoverflow.com/a/68338888/721855 for an example on how to implement it in Java code, and the Java Module documentation to use the code from a Mule application. But remember that it will depend on the DNS configuration if it is possible to reverse lookup any IP.