fix(striker-ui-api): enhance VNC proxy error messages

main
Tsu-ba-me 9 months ago
parent 7b3e445ed0
commit 10087b5c58
  1. 10
      striker-ui-api/src/lib/accessModule.ts
  2. 15
      striker-ui-api/src/middlewares/proxyServerVnc.ts

@ -492,7 +492,15 @@ const getVncinfo = async (serverUuid: string): Promise<ServerDetailVncInfo> => {
const port = Number(rPort);
const protocol = 'ws';
return { domain, port, protocol };
const result: ServerDetailVncInfo = {
domain,
port,
protocol,
};
shvar(result, `VNC info for server [${serverUuid}]: `);
return result;
};
export {

@ -1,4 +1,3 @@
import { ServerResponse } from 'http';
import { createProxyMiddleware } from 'http-proxy-middleware';
import { P_UUID } from '../lib/consts';
@ -37,9 +36,19 @@ export const proxyServerVnc = createProxyMiddleware({
},
on: {
error: (error, request, response) => {
stderr(String(error));
stderr(`VNC proxy error: ${error}`);
(response as ServerResponse).writeHead(404).end();
let resType: string;
if ('writeHead' in response) {
resType = 'ServerResponse';
response.writeHead(500).end();
} else {
resType = 'Socket';
}
stdout(`Response type = ${resType}`);
},
},
ws: true,

Loading…
Cancel
Save