diff --git a/Nginx/default.conf.template b/Nginx/default.conf.template index a87552f9241..8549dd5b8f4 100644 --- a/Nginx/default.conf.template +++ b/Nginx/default.conf.template @@ -563,6 +563,24 @@ server { client_max_body_size 50M; } + # For backward compatibility with probes that are already deployed + location /ingestor { + # This is for nginx not to crash when service is not available. + resolver 127.0.0.1 valid=30s; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + # enable WebSockets (for ws://sockjs not connected error in the accounts source: https://stackoverflow.com/questions/41381444/websocket-connection-failed-error-during-websocket-handshake-unexpected-respon) + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_pass http://probe-ingest; + + client_max_body_size 50M; + } + location /server-monitor { # This is for nginx not to crash when service is not available. resolver 127.0.0.1 valid=30s; diff --git a/Probe/Config.ts b/Probe/Config.ts index e70e516f9ec..6312dc3acf9 100644 --- a/Probe/Config.ts +++ b/Probe/Config.ts @@ -18,7 +18,9 @@ if ( !PROBE_INGEST_URL.toString().endsWith("probe-ingest") && !PROBE_INGEST_URL.toString().endsWith("probe-ingest/") ) { - PROBE_INGEST_URL = URL.fromString(PROBE_INGEST_URL.addRoute("/probe-ingest").toString()); + PROBE_INGEST_URL = URL.fromString( + PROBE_INGEST_URL.addRoute("/probe-ingest").toString(), + ); } export const PROBE_NAME: string | null = process.env["PROBE_NAME"] || null; diff --git a/ProbeIngest/Index.ts b/ProbeIngest/Index.ts index cd96871f1ff..2705cf0efe5 100644 --- a/ProbeIngest/Index.ts +++ b/ProbeIngest/Index.ts @@ -1,6 +1,4 @@ -import IncomingRequestAPI from "../IncomingRequestIngest/API/IncomingRequest"; import MonitorAPI from "./API/Monitor"; -import OTelIngestAPI from "./API/OTelIngest"; import ProbeIngest from "./API/Probe"; import RegisterAPI from "./API/Register"; import ServerMonitorAPI from "./API/ServerMonitor"; @@ -20,12 +18,11 @@ const app: ExpressApplication = Express.getExpressApp(); const APP_NAME: string = "probe-ingest"; -app.use([`/${APP_NAME}`, "/"], RegisterAPI); -app.use([`/${APP_NAME}`, "/"], MonitorAPI); -app.use([`/${APP_NAME}`, "/"], ProbeIngest); -app.use([`/${APP_NAME}`, "/"], IncomingRequestAPI); -app.use([`/${APP_NAME}`, "/"], OTelIngestAPI); -app.use([`/${APP_NAME}`, "/"], ServerMonitorAPI); +// "/ingestor" is used here for backward compatibility because probes are already deployed with this path in client environments. +app.use([`/${APP_NAME}`, "/ingestor", "/"], RegisterAPI); +app.use([`/${APP_NAME}`, "/ingestor", "/"], MonitorAPI); +app.use([`/${APP_NAME}`, "/ingestor", "/"], ProbeIngest); +app.use([`/${APP_NAME}`, "/ingestor", "/"], ServerMonitorAPI); const init: PromiseVoidFunction = async (): Promise => { try {