summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Pittier <jordan.pittier-ext@cloudwatt.com>2013-08-20 19:04:36 +0200
committerJeremy White <jwhite@codeweavers.com>2013-08-23 12:53:37 -0500
commitb0509ca4495928b267defcca016de18021a36436 (patch)
treecca5c59fc312b673a9c409705c7c30138430bd82
parent96e6383995c9e764d8043b128ca3f185d5d8a4bd (diff)
Fix default websocket port detection in spice_auto.html
If server runs on port 80 or 443 the default value of window.location.port is an empty string Signed-off-by: Jordan Pittier <jordan.pittier-ext@cloudwatt.com>
-rw-r--r--spice_auto.html15
1 files changed, 14 insertions, 1 deletions
diff --git a/spice_auto.html b/spice_auto.html
index 81ec8cf..0a01996 100644
--- a/spice_auto.html
+++ b/spice_auto.html
@@ -85,7 +85,20 @@
// 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);
+
+ // Note that using the web server port only makes sense
+ // if your web server has a reverse proxy to relay the WebSocket
+ // traffic to the correct destination port.
+ var default_port = window.location.port;
+ 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.