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 did, 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 see it. It is not consistently showing it. How can I get consistently the domain name of the website making the request?