From 2aac5dea1204812c0162b49786fae40fbc07f66c Mon Sep 17 00:00:00 2001 From: Petr Vecera Date: Mon, 24 Oct 2022 10:54:41 +0200 Subject: [PATCH] Use proxy --- edgio.config.js | 34 +++++++++++++++++----------------- routes.ts | 11 ++++++++--- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/edgio.config.js b/edgio.config.js index 7a980b3b..a1e92b4f 100644 --- a/edgio.config.js +++ b/edgio.config.js @@ -10,23 +10,23 @@ module.exports = { //The name of the team in Edgio to which this app should be deployed. team: "coh-stats", - // backends: { - // origin: { - // // The domain name or IP address of the origin server - // domainOrIp: 'example.com', - // - // // When provided, the following value will be sent as the host header when connecting to the origin. - // // If omitted, the host header from the browser will be forwarded to the origin. - // hostHeader: 'example.com', - // - // // Uncomment the following line if TLS is not set up properly on the origin domain and you want to ignore TLS errors - // // disableCheckCert: true, - // - // // Overrides the default ports (80 for http and 443 for https) and instead use a specific port - // // when connecting to the origin - // // port: 1337, - // }, - // }, + backends: { + self: { + // The domain name or IP address of the origin server + domainOrIp: 'coh3stats.com', + + // When provided, the following value will be sent as the host header when connecting to the origin. + // If omitted, the host header from the browser will be forwarded to the origin. + hostHeader: 'coh3stats.com', + + // Uncomment the following line if TLS is not set up properly on the origin domain and you want to ignore TLS errors + // disableCheckCert: true, + + // Overrides the default ports (80 for http and 443 for https) and instead use a specific port + // when connecting to the origin + // port: 1337, + }, + }, // Overrides the default path to the routes file. The path should be relative to the root of your app. // routes: 'routes.js', diff --git a/routes.ts b/routes.ts index 41e8ec38..b45669a0 100644 --- a/routes.ts +++ b/routes.ts @@ -17,11 +17,16 @@ export default new Router() { path: "/", headers: { - host: "coh3stats.com", + host: "dev.coh3stats.com", }, }, - ({ redirect }) => { - redirect("/landing", { statusCode: 302 }); + ({ proxy, cache }) => { + cache({ + edge: { + maxAgeSeconds: 30 * 24 * 60 * 60, + }, + }); + proxy("self", { path: "/landing" }); }, ) .match("/api/onlineSteamPlayers", ({ cache }) => {