GitHub user nacx opened a pull request:
https://github.com/apache/incubator-guacamole-client/pull/210
Allow to send custom headers with the Guacamole tunnel requests
When establishing a Guacamole tunnel to an endpoint that requires (for
example) authentication, it is often needed to send custom headers. The
existing `withCredentials` option works well for session cookies in
cross-domain environments, but when there are no sessions or authentication
relies on headers, there is no way to have an authenticated tunnel request.
This PR adds an optional variable to the `HTTPTunnel` so users can
configure a set of custom headers to be sent on every tunnel request. That can
be used to configure additional headers for authentication, distributed
tracing, and other needs. Something like:
```javascript
var tunnel = new Guacamole.HTTPTunnel(endpoint, true);
tunnel.extraHeaders = {
"X-Auth-Token": "Foo",
"X-Auth-Signature": "Bar",
"X-Trace-Id": "uuid"
};
var guac = new Guacamole.Client(tunnel);
````
I've also preferred not to add the extra headers to the tunnel constructor
to keep backward compatibility.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/nacx/incubator-guacamole-client tunnel-headers
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-guacamole-client/pull/210.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #210
----
commit b734de6aadbff2207aa84b4460003b73f5c153cc
Author: Ignasi Barrera <[email protected]>
Date: 2017-11-16T12:03:17Z
Custom headers for Guacamole tunnel
----
---