diff --git a/server/index.ts b/server/index.ts index f963b13f..545cac2f 100644 --- a/server/index.ts +++ b/server/index.ts @@ -96,21 +96,24 @@ async function startServer() { process.env.VITE_MACROSTRAT_INSTANCE ); - // + // CriticalMAAS CDR integration // Proxy requests to /tile/* to https://api.cdr.land/v1/tiles/* // Add the Authorization header to the proxied request // - app.use("/tiles", proxy( - "https://api.cdr.land", { - proxyReqOptDecorator: (opts) => { - opts.headers["Authorization"] = `Bearer ${process.env.CDR_API_KEY}`; - return opts; - }, - proxyReqPathResolver: (req) => { - return `/v1/tiles${req.url}`; - } - }) - ) + if (process.env.CDR_API_KEY) { + app.use( + "/tiles", + proxy("https://api.cdr.land", { + proxyReqOptDecorator: (opts) => { + opts.headers["Authorization"] = `Bearer ${process.env.CDR_API_KEY}`; + return opts; + }, + proxyReqPathResolver: (req) => { + return `/v1/tiles${req.url}`; + }, + }) + ); + } /** * Vike route diff --git a/src/pages/+config.ts b/src/pages/+config.ts index a748656b..475e646e 100644 --- a/src/pages/+config.ts +++ b/src/pages/+config.ts @@ -25,6 +25,7 @@ export default { "description", "title", "environment", + "urlPathname", ], clientRouting: true, meta: {