From c892850f79e84b9c396dceef382ce32bbdf68802 Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Mon, 16 Mar 2026 10:06:41 -0400 Subject: [PATCH] Return 405 instead of 426 for HTTP requests to WebSocket endpoint When no envVars are provided, the HTTP request handler now returns 405 Method Not Allowed instead of 426 Upgrade Required. This prevents confusing "Invalid appenv schema" errors in the jambonz portal when it sends an OPTIONS probe to discover application environment variables. Closes #2 Co-Authored-By: Claude Opus 4.6 --- typescript/src/websocket/endpoint.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/typescript/src/websocket/endpoint.ts b/typescript/src/websocket/endpoint.ts index 162f4fc..38b6b79 100644 --- a/typescript/src/websocket/endpoint.ts +++ b/typescript/src/websocket/endpoint.ts @@ -89,15 +89,15 @@ export function createEndpoint(opts: EndpointOptions): MakeService { // Audio path registry (exact match — no prefix routing needed) const audioRoutes = new Map(); - // Handle regular HTTP requests (OPTIONS for env var discovery, 426 for everything else) + // Handle regular HTTP requests (OPTIONS for env var discovery, 405 for everything else) server.on('request', (req: http.IncomingMessage, res: http.ServerResponse) => { if (req.method === 'OPTIONS' && envVars) { res.writeHead(200, { 'Content-Type': 'application/json' }); res.end(JSON.stringify(envVars)); return; } - res.writeHead(426, { 'Content-Type': 'text/plain' }); - res.end('Upgrade Required'); + res.writeHead(405, { 'Content-Type': 'text/plain' }); + res.end('Method Not Allowed'); }); server.on('upgrade', (req: http.IncomingMessage, socket, head: Buffer) => {