Github user necouchman commented on a diff in the pull request:
https://github.com/apache/incubator-guacamole-client/pull/109#discussion_r97836251
--- Diff: guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java
---
@@ -58,6 +68,27 @@ public APIRequest(HttpServletRequest request,
super(request);
+ // Try a few methods to get client info.
+ if(request.getHeader("X-Guacamole-Client-Hostname") != null &&
request.getHeader("X-Guacamole-Client-Hostname") != "") {
+ this.remoteHost =
request.getHeader("X-Guacamole-Client-Hostname");
+ } else if(request.getHeader("X-Forwarded-For") != null &&
request.getHeader("X-Forwarded-For") != "") {
+ this.remoteHost = request.getHeader("X-Forwarded-For");
+ } else if(request.getRemoteHost() != null &&
request.getRemoteHost() != "") {
+ this.remoteHost = request.getRemoteHost();
+ } else {
+ this.remoteHost = "";
+ }
+
+ if(request.getHeader("X-Guacamole-Client-IP") != null &&
request.getHeader("X-Guacamole-Client-IP") != "") {
+ this.remoteAddr = request.getHeader("X-Guacamole-Client-IP");
+ } else if(request.getHeader("X-Forwarded-For") != null &&
request.getHeader("X-Forwarded-For") != "") {
+ this.remoteAddr = request.getHeader("X-Forwarded-For");
--- End diff --
Yes, that's correct...I was going under the assumption that if you're
relying on X-Forwarded-For (which is usually an IP address) you'd want that in
both tokens. I can remove the check from the hostname one so that the
X-Forwarded-For only applies to the IP, or I could, instead, check to see if
X-Forwarded-For is an IP-type value and assign it based on whether or not an IP
is present??
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---