feat(xo-server/proxy-console): work around missing host (#3435)

Fixes #3432
This commit is contained in:
Julien Fontanet 2018-09-20 14:47:39 +02:00 committed by GitHub
parent ea1c3ab54a
commit 0215c19d1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 2 deletions

View File

@ -20,6 +20,7 @@
- [XOA updater] Fix issue where trial request would fail [#3407](https://github.com/vatesfr/xen-orchestra/issues/3407) (PR [#3412](https://github.com/vatesfr/xen-orchestra/pull/3412))
- [Backup NG logs] Fix log's value not being updated in the copy and report button [#3273](https://github.com/vatesfr/xen-orchestra/issues/3273) (PR [#3360](https://github.com/vatesfr/xen-orchestra/pull/3360))
- [Backup NG] Fix issue when *Delete first* was enabled for some of the remotes [#3424](https://github.com/vatesfr/xen-orchestra/issues/3424) (PR [#3427](https://github.com/vatesfr/xen-orchestra/pull/3427))
- [VM/host consoles] Work around a XenServer/XCP-ng issue which lead to some consoles not working [#3432](https://github.com/vatesfr/xen-orchestra/issues/3432) (PR [#3435](https://github.com/vatesfr/xen-orchestra/pull/3435))
### Released packages

View File

@ -7,12 +7,23 @@ const debug = createDebug('xo:proxy-console')
export default function proxyConsole (ws, vmConsole, sessionId) {
const url = parse(vmConsole.location)
let { hostname } = url
if (hostname === null || hostname === '') {
console.warn(
'host is missing in console (%s) URI (%s)',
vmConsole.uuid,
vmConsole.location
)
const { address } = vmConsole.$VM.$resident_on
console.warn(' using host address (%s) as fallback', address)
hostname = address
}
let closed = false
const socket = connect(
{
host: url.hostname,
host: hostname,
port: url.port || 443,
rejectUnauthorized: false,
},
@ -21,7 +32,7 @@ export default function proxyConsole (ws, vmConsole, sessionId) {
socket.write(
[
`CONNECT ${url.path} HTTP/1.0`,
`Host: ${url.hostname}`,
`Host: ${hostname}`,
`Cookie: session_id=${sessionId}`,
'',
'',