Skip to content

Commit

Permalink
Use proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
petrvecera committed Oct 24, 2022
1 parent d84b576 commit 2aac5de
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 deletions.
34 changes: 17 additions & 17 deletions edgio.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
11 changes: 8 additions & 3 deletions routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => {
Expand Down

0 comments on commit 2aac5de

Please sign in to comment.