In a Spring or Restlet web application, how can I get the domain name of the client?
What I can do now is get client IP address only:
String clientIp = getRequest().getClientInfo().getAddress();
However I need to get the domain name of the client.
Mainly because I am making a proxy
app which domains from GoDaddy (for example)
:
www CNAME
to the proxy
app.xyz.com
, or abc.com
and forward it to a specific IP or another domain. In a general way, I suggest you have a look at the full content of the incoming request. Check the provided headers and see if they contain the data you need.
Uusing Restlet, you can have a look at the request#ClientInfo#UpStreamAddress method. It takes care of forwarding data provided by the request, and returns the client's IP. I don't know what you mean by client's host domain.