如果 servlet 隧道与 html 文件不在同一主机/服务器上,我可以调用 Guacamole.HTTPTunnel("tunnel")

Can I call Guacamole.HTTPTunnel("tunnel") in a case where tunnel the servlet is not on the same host/ server as the html file

我正在尝试在此处的示例中为鳄梨酱实例化客户端

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

这是来自这里的例子 https://guacamole.incubator.apache.org/doc/gug/writing-you-own-guacamole-app.html

我可以这样做吗 if/when 我在 html 文件所在的不同主机上有 servlet(隧道)?

是的,您可以连接到托管在不同域上的 Guacamole HTTP 隧道。您需要为隧道指定完整的 URL(而不是相对的 URL "tunnel"),以及创建 [=13= 时的可选 crossDomain 参数]:

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

例如:

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

使用 Guacamole's WebSocket tunnel 也是一种选择,因为跨域限制在那里不适用。