GUI-1375
re-factored code to get remote addr from headers