invalidate cached pixel
This commit is contained in:
parent
278f3ad078
commit
1ee5a42a59
7
index.ts
7
index.ts
@ -38,11 +38,14 @@ app.get('/', (req, res) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/cache-me.webp', (_, res) => {
|
const sendPixel = (_: express.Request, res: express.Response) => {
|
||||||
res.set('Cache-Control', 'private, max-age=31557600'); // one year
|
res.set('Cache-Control', 'private, max-age=31557600'); // one year
|
||||||
visitCount++;
|
visitCount++;
|
||||||
res.sendFile(Path.join(import.meta.dir, 'assets', 'webp', 'cache-me.webp'));
|
res.sendFile(Path.join(import.meta.dir, 'assets', 'webp', 'cache-me.webp'));
|
||||||
});
|
}
|
||||||
|
|
||||||
|
app.get('/cache-me.webp', sendPixel);
|
||||||
|
app.get('/cache-me-2.webp', sendPixel);
|
||||||
|
|
||||||
app.all('*', (req, res) => {
|
app.all('*', (req, res) => {
|
||||||
console.log(`404: ${req.url} requested by ${req.ip} "${req.headers['user-agent']}"`);
|
console.log(`404: ${req.url} requested by ${req.ip} "${req.headers['user-agent']}"`);
|
||||||
|
@ -46,7 +46,7 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#pixel {
|
#pixel {
|
||||||
background: url('/cache-me.webp');
|
background: url('/cache-me-2.webp');
|
||||||
position: fixed;
|
position: fixed;
|
||||||
left: -99999999999999px;
|
left: -99999999999999px;
|
||||||
top: -20px;
|
top: -20px;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
JAKE HURWITZ IS A BITCH
|
JAKE HURWITZ IS A BITCH
|
||||||
</title>
|
</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<link rel="stylesheet" href="/assets/css/styles.css?v2">
|
<link rel="stylesheet" href="/assets/css/styles.css?v3">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user