Thanks Alex and Nikolay,
Changed my code to look for either X-Forwarded-for header or if that null, request.getRemoteAddr so that I can still test on local machine. And is working nicely.
I suggest that it might be worth adding this little nugget of info somewhere in the help doco - as imagine others might need it too.
Cheers,
Chris