ServletUriComponentsBuilder builder = ServletUriComponentsBuilder.fromServletMapping(request);
String forwardedSsl = request.getHeader("X-Forwarded-Ssl");
if (StringUtils.hasText(forwardedSsl) && forwardedSsl.equalsIgnoreCase("on")) {
builder.scheme("https");
}
String host = request.getHeader("X-Forwarded-Host");
if (!StringUtils.hasText(host)) {