We have a requirement in the ReSt application to generate a hyperlink to one of web pages in the pdf file. For that we would want to get the host name of the environment where the application is running. The request flow is like below,
user => Web application =>ReSt application.
The x-forwarded-host header contains the domain name of the application. We use this in our code and able to generate the link
String host = httpServletRequest.getHeader("x-forwarded-host");