1

I am trying to instantiate client for guacamole in the example here

// Instantiate client, using an HTTP tunnel for communications.
            var guac = new Guacamole.Client(
                new Guacamole.HTTPTunnel("tunnel")
            );

This is from the example here https://guacamole.incubator.apache.org/doc/gug/writing-you-own-guacamole-app.html

Can I possibly do this if/when I have the servlet (tunnel) on a different host that the html file?

Japheth Odonya
  • 333
  • 4
  • 15
  • Do you see any error messages in the browser console when request is made? Maybe you need to include CORS headers in the response? I assume this sets up a regular HTTP connection to a service via XHR which requires CORS headers for cross-domain requests. Also make sure that Guacamole can handle `OPTIONS` HTTP request which is a preflight request issued before the actual request. You can find more details about CORS here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS – Igor Nikolaev Jan 07 '17 at 21:56
  • Thanks Igor, I didnt know I could specify the full url to the servlet as Mike Jumper explained in his answer below, that was the problem once I specified the full url it worked. – Japheth Odonya Jan 16 '17 at 18:05

1 Answers1

2

Yes, you can connect to a Guacamole HTTP tunnel hosted on a different domain. You will need to specify the full URL to the tunnel (rather than the relative URL "tunnel"), as well as the optional crossDomain parameter when creating the Guacamole.HTTPTunnel:

http://guacamole.incubator.apache.org/doc/guacamole-common-js/Guacamole.HTTPTunnel.html

For example:

// Instantiate client, using an HTTP tunnel for communications.
var guac = new Guacamole.Client(
    new Guacamole.HTTPTunnel("https://full/url/to/tunnel", true)
);

Using Guacamole's WebSocket tunnel is also an option, as cross-origin restrictions do not apply there.

Mike Jumper
  • 410
  • 3
  • 8