retspen/webvirtcloud

Hardcoded websocket path when using noVNC full version

Closed this issue · 10 comments

I have to change ws_path everytime when I want to use noVNC full variant.

Hardcoded here:

<label for="noVNC_setting_path">Path:</label>
<input id="noVNC_setting_path" type="text" value="websockify">

The lite version works because:

//const path = readQueryVariable('path', 'websockify');
const path = readQueryVariable('path', '{{ ws_path }}');

get data from:

ws_path = WS_PUBLIC_PATH if WS_PUBLIC_PATH else "/"
if ":" in ws_host:
ws_host = re.sub(":[0-9]+", "", ws_host)
if console_type == "vnc" or console_type == "spice":
console_page = "console-" + console_type + "-" + view_type + ".html"
response = render(request, console_page, locals())
else:
if console_type is None:
console_error = _("Fail to get console. Please check the console configuration of your VM.")
else:
console_error = _("Console type '%(type)s' has not support") % {"type": console_type}
response = render(request, "console-vnc-lite.html", locals())

The issue is caused by 43f1461

@catborise @retspen The template got removed from the commit above. Is it intentional?

I dont think it is intentional change, may be it is missed. We could change it, if it is useful.

I think it's useful as it's more convenient.

@catborise Any update on this?

@wongsyrone it is initiated at different place. changing "websockify" does not affect. i think it is set in UI.js which is not reach ws_path value.

@catborise

Nope. I fixed it on my side by reverting partial changes (console-vnc-full.html) of 43f1461

@wongsyrone i change it. but i cannot test it(my test shows no effect). if it is working fine...

24cd3f7 looks good to me.

I don't think this fix works at all. If I view the HTML source, I do see the correct HTML code, but in the console settings, it is still set to "websockify".

May I suggest just adding the location conf for "websockify" to /etc/nginx/conf.d/webvirtcloud.conf as a workaround. This fixes the issue.

    location /websockify {
        proxy_pass http://wssocketiod;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }