-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy path01-wsproxy.patch
138 lines (122 loc) · 5.06 KB
/
01-wsproxy.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
diff --git a/conf/nginx/webvirtcloud.conf b/conf/nginx/webvirtcloud.conf
index 70b8e0e..2eae863 100644
--- a/conf/nginx/webvirtcloud.conf
+++ b/conf/nginx/webvirtcloud.conf
@@ -20,4 +20,15 @@ server {
proxy_send_timeout 600;
client_max_body_size 1024M;
}
+
+ location /novncd/ {
+ proxy_pass http://wsnovncd;
+ proxy_http_version 1.1;
+ proxy_set_header Upgrade $http_upgrade;
+ proxy_set_header Connection "upgrade";
+ }
+}
+
+upstream wsnovncd {
+ server 127.0.0.1:6080;
}
diff --git a/console/templates/console-spice-full.html b/console/templates/console-spice-full.html
index 5accf4d..118f243 100644
--- a/console/templates/console-spice-full.html
+++ b/console/templates/console-spice-full.html
@@ -115,7 +115,7 @@
sc.stop();
}
- uri = scheme + host + ":" + port;
+ uri = scheme + "{{ ws_host }}:{{ ws_port }}{{ ws_path }}";
document.getElementById('connectButton').innerHTML = "Stop";
document.getElementById('connectButton').onclick = disconnect;
diff --git a/console/templates/console-spice-lite.html b/console/templates/console-spice-lite.html
index 8f89678..f4968ad 100644
--- a/console/templates/console-spice-lite.html
+++ b/console/templates/console-spice-lite.html
@@ -142,7 +142,7 @@
password = '{{ console_passwd | safe }}';
if (password === 'None') password = '';
- path = spice_query_var('path', 'websockify');
+ path = spice_query_var('path', '{{ ws_path }}');
if ((!host) || (!port)) {
console.log("must specify host and port in URL");
diff --git a/console/templates/console-vnc-full.html b/console/templates/console-vnc-full.html
index 6149289..ab30c62 100755
--- a/console/templates/console-vnc-full.html
+++ b/console/templates/console-vnc-full.html
@@ -241,7 +241,7 @@
</li>
<li>
<label for="noVNC_setting_path">Path:</label>
- <input id="noVNC_setting_path" type="input" value="websockify" />
+ <input id="noVNC_setting_path" type="input" value="{{ ws_path }}" />
</li>
</ul></div>
</li>
@@ -332,4 +332,4 @@
<source src="{% static "js/novnc/app/sounds/bell.oga" %}" type="audio/ogg">
<source src="{% static "js/novnc/app/sounds/bell.mp3" %}" type="audio/mpeg">
</audio>
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/console/templates/console-vnc-lite.html b/console/templates/console-vnc-lite.html
index 4dd7bfe..0cc011d 100755
--- a/console/templates/console-vnc-lite.html
+++ b/console/templates/console-vnc-lite.html
@@ -235,14 +235,14 @@
//var password = WebUtil.getConfigVar('password', '');
var password = '{{ console_passwd }}';
- var path = WebUtil.getConfigVar('path', 'websockify');
+ var path = WebUtil.getConfigVar('path', '{{ ws_path }}');
// If a token variable is passed in, set the parameter in a cookie.
// This is used by nova-novncproxy.
var token = WebUtil.getConfigVar('token', null);
if (token) {
// if token is already present in the path we should use it
- path = WebUtil.injectParamIfMissing(path, "token", token);
+ path = path + WebUtil.injectParamIfMissing(path, "token", token);
WebUtil.createCookie('token', token, 1)
}
diff --git a/console/views.py b/console/views.py
index 4196ff0..cac6208 100644
--- a/console/views.py
+++ b/console/views.py
@@ -7,6 +7,8 @@ from instances.models import Instance
from vrtManager.instance import wvmInstance
from webvirtcloud.settings import WS_PORT
from webvirtcloud.settings import WS_PUBLIC_HOST
+from webvirtcloud.settings import WS_PUBLIC_PATH
+from webvirtcloud.settings import WS_PUBLIC_PORT
from libvirt import libvirtError
@@ -40,8 +42,9 @@ def console(request):
console_websocket_port = None
console_passwd = None
- ws_port = console_websocket_port if console_websocket_port else WS_PORT
+ ws_port = console_websocket_port if console_websocket_port else WS_PUBLIC_PORT
ws_host = WS_PUBLIC_HOST if WS_PUBLIC_HOST else request.get_host()
+ ws_path = WS_PUBLIC_PATH if WS_PUBLIC_PATH else '/'
if ':' in ws_host:
ws_host = re.sub(':[0-9]+', '', ws_host)
diff --git a/webvirtcloud/settings.py.template b/webvirtcloud/settings.py.template
index 5e59e92..4b0368a 100644
--- a/webvirtcloud/settings.py
+++ b/webvirtcloud/settings.py
@@ -97,15 +97,21 @@ TEMPLATES = [
## WebVirtCloud settings
-# Wobsock port
+# Websock port
WS_PORT = 6080
# Websock host
WS_HOST = '0.0.0.0'
-# Websock public port
+# Websock public host
WS_PUBLIC_HOST = None
+# Websock public port
+WS_PUBLIC_PORT = 80
+
+# Websock public path
+WS_PUBLIC_PATH = '/novncd/'
+
# Websock SSL connection
WS_CERT = None