Get remoteAddress from service request object

Enonic version: 6.6
OS: OSx El Capitan

Hey guys, I need to know who requested my service, in order to put a whitelist (I only want this service to be accessible from within my server, not from outside), and from the documentation ( there was supposed to be a remoteAddress field on the request object. However, there’s nothing in it. Any idea why?

The service is accessible via get.


Yes, there should be a remoteAddress String property with the IP address.

function handleGet(req) {;

Is it neither present when you connect directly from localhost?

Check if some other front-end server or proxy is setting the HTTP header X-Forwarded-For, that would override the original remoteAddress.