0

How can I get the domain name of the website making the request from the ServerHttpRequest object. The domain name as seen in the browser.

Here is what I have tried but it doesn't display the domain name from browser.

ServerHttpRequest requests = request.getRequest();

logger.info(requests.getRemoteAddress());
logger.info(requests.getRemoteAddress().getHostName()); 
logger.info(requests.getHeaders().getOrEmpty("origin").get(0)); 
logger.info(requests.getHeaders().getOrEmpty("referer").get(0));

All those are not successful. Sometimes I see the domain in the "origin" field of Header or in the "referer" field and sometimes I do not. It is not consistently showing it... How can I get consistently the domain name of the website making the request.

kerbermeister
  • 2,985
  • 3
  • 11
  • 30
user3648235
  • 169
  • 4
  • 13

0 Answers0