Handle some 404's better

This commit is contained in:
Marcus Noble 2021-09-03 07:02:57 +01:00
parent eeebcd3472
commit c10c858988
4 changed files with 14 additions and 2 deletions

15
app.js
View File

@ -29,12 +29,23 @@ app.use(express.static(__dirname + '/build'));
// Lets try and slow down some of those exploit crawlers // Lets try and slow down some of those exploit crawlers
app.use("/", require('./filterRoutes')); app.use("/", require('./filterRoutes'));
// Handle some iOS icon 404s
app.get("/apple-touch-icon*", function(req, res) {
res.sendFile(__dirname + '/build/images/favico/' + req.url, () => {
res.sendFile(__dirname + '/build/images/favico/apple-touch-icon.png');
});
});
app.get("/favicon.png", function(req, res) {
res.sendFile(__dirname + '/build/images/favico/apple-touch-icon.png');
});
app.get("/robots.txt", function(req, res) { app.get("/robots.txt", function(req, res) {
res.send("User-agent: * Disallow: "); res.send("User-agent: * Disallow: ");
}) })
app.get(/\/(feed|rss)\/?$/, function(req, res) { app.get(/(\/(feeds?|rss|atom)\/?|feed.xml|rss.xml|index.rss|feed.rss)$/, function(req, res) {
res.redirect('/feed.xml'); res.redirect(301, '/feed.xml');
}) })
app.get("/healthz", function(req, res) { app.get("/healthz", function(req, res) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

View File

@ -18,6 +18,7 @@
<!-- Twitter Do Not Track --> <!-- Twitter Do Not Track -->
<meta name="twitter:dnt" content="on"> <meta name="twitter:dnt" content="on">
<link rel="apple-touch-icon" href="/images/favico/apple-icon-180x180.png"/>
<link rel="apple-touch-icon" sizes="57x57" href="/images/favico/apple-icon-57x57.png"> <link rel="apple-touch-icon" sizes="57x57" href="/images/favico/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/images/favico/apple-icon-60x60.png"> <link rel="apple-touch-icon" sizes="60x60" href="/images/favico/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="/images/favico/apple-icon-72x72.png"> <link rel="apple-touch-icon" sizes="72x72" href="/images/favico/apple-icon-72x72.png">