Skip to content

Instantly share code, notes, and snippets.

@pulse00
Created October 22, 2014 09:52
Show Gist options
  • Save pulse00/3f6ee815ceda619cf9fc to your computer and use it in GitHub Desktop.
Save pulse00/3f6ee815ceda619cf9fc to your computer and use it in GitHub Desktop.
Object rawRequest = RequestCycle.get().getRequest().getContainerRequest();
if (rawRequest instanceof HttpServletRequest) {
HttpServletRequest servletRequest = (HttpServletRequest) rawRequest;
String proxyHost = servletRequest.getHeader("X-Forwarded-Host");
String proxyPort = servletRequest.getHeader("X-Forwarded-Port");
if (proxyHost != null) {
hostname = proxyHost;
}
if (proxyPort != null) {
port = Integer.parseInt(proxyPort);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment