Skip to content

Commit

Permalink
Remove cache from editor, because it caused the game to not load corr…
Browse files Browse the repository at this point in the history
…ectly (#2651)

remove cache from editor, because it caused the game to not load correctly
  • Loading branch information
Cosmin-Mare authored Nov 26, 2024
1 parent 66c4f6d commit 0e39c17
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@ import metrics from "../metrics";

export async function onRequest({ request }: any, next: () => any) {
const path = new URL(request.url).pathname.slice(1);
const response = await next();

if(path.includes("~") || path.includes("editor")) {
response.headers.set('Cache-Control', 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0');
}

if (!path.includes("api")) return next();
if (!path.includes("api")) return response;

const metricName = path.split("/").join("_");
const start = performance.now();
const response = await next();
const time = performance.now() - start;

const metricKey = `http.${response.status}.${metricName}`;
Expand Down

0 comments on commit 0e39c17

Please sign in to comment.