[Spice-devel] [PATCH] Fix default websocket port detection in spice_auto.html
Jordan Pittier
jordan.pittier-ext at cloudwatt.com
Fri Aug 23 01:50:16 PDT 2013
Hi,
>I'm concerned that setting port 80/443 as the default may be misleading
>to the average user.
Yep, you're right. But the patch is not really defaulting to port 80 or 443, it's more like a "fallback" port if window.location.port is empty. window.location.port still have precedence.
>In general, the port we need to specify is going to connect to a
>websockify daemon, which will relay it on to a spice server.
Yep, again. In my setup, we don't want to expose the websockify daemon on the internet, it is hidden behind an Nginx reverse proxy. Nginx listen on port 443 and forward all the HTTP traffic to the right backend based on the content of the HTTP "Host:" header. The websockify daemon runs on a dedicated VM with a dedicated hostname.
>That is, will nginx and/or
>Apache intelligently relay a ws:// protocol request to an alternate port?
Exactly.
Jordan
----- Original Message -----
From: "Jeremy White" <jwhite at codeweavers.com>
To: spice-devel at lists.freedesktop.org
Sent: Thursday, August 22, 2013 5:36:25 PM
Subject: Re: [Spice-devel] [PATCH] Fix default websocket port detection in spice_auto.html
Hi Jordan,
On 08/20/2013 12:04 PM, Jordan Pittier wrote:
> If server runs on port 80 or 443 the default value of
> window.location.port is an empty string
I'm concerned that setting port 80/443 as the default may be misleading
to the average user.
In general, the port we need to specify is going to connect to a
websockify daemon, which will relay it on to a spice server. And, in
general, that websockify instance will need to be running on a port
*other* than 80/443, as 80/443 is usually consumed by a web server.
I realize that you may be proxying the port; I'm not very familiar with
that process. Is this a protocol proxy? That is, will nginx and/or
Apache intelligently relay a ws:// protocol request to an alternate port?
Cheers,
Jeremy
>
> Signed-off-by: Jordan Pittier <jordan.pittier-ext at cloudwatt.com>
> ---
> spice_auto.html | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/spice_auto.html b/spice_auto.html
> index 81ec8cf..3c853bc 100644
> --- a/spice_auto.html
> +++ b/spice_auto.html
> @@ -85,7 +85,19 @@
>
> // By default, use the host and port of server that served this file
> host = spice_query_var('host', window.location.hostname);
> - port = spice_query_var('port', window.location.port);
> + var default_port = window.location.port;
> +
> + // if this page is served by a server listening
> + // on port 80 or 443, default_port is an empty string
> + if (!default_port) {
> + if (window.location.protocol == 'http:') {
> + default_port = 80;
> + }
> + else if (window.location.protocol == 'https:') {
> + default_port = 443;
> + }
> + }
> + port = spice_query_var('port', default_port);
>
> // If a token variable is passed in, set the parameter in a cookie.
> // This is used by nova-spiceproxy.
_______________________________________________
Spice-devel mailing list
Spice-devel at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel
More information about the Spice-devel
mailing list