invalidate cached pixel
This commit is contained in:
parent
278f3ad078
commit
1ee5a42a59
9
index.ts
9
index.ts
@ -38,13 +38,16 @@ 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
|
||||
visitCount++;
|
||||
res.sendFile(Path.join(import.meta.dir, 'assets', 'webp', 'cache-me.webp'));
|
||||
});
|
||||
}
|
||||
|
||||
app.all('*', (req, res) => {
|
||||
app.get('/cache-me.webp', sendPixel);
|
||||
app.get('/cache-me-2.webp', sendPixel);
|
||||
|
||||
app.all('*', (req, res) => {
|
||||
console.log(`404: ${req.url} requested by ${req.ip} "${req.headers['user-agent']}"`);
|
||||
res.redirect('/');
|
||||
});
|
||||
|
@ -46,7 +46,7 @@ body {
|
||||
}
|
||||
|
||||
#pixel {
|
||||
background: url('/cache-me.webp');
|
||||
background: url('/cache-me-2.webp');
|
||||
position: fixed;
|
||||
left: -99999999999999px;
|
||||
top: -20px;
|
||||
|
@ -7,7 +7,7 @@
|
||||
JAKE HURWITZ IS A BITCH
|
||||
</title>
|
||||
<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>
|
||||
|
||||
<body>
|
||||
|
Loading…
x
Reference in New Issue
Block a user