forked from snxraven/ravenscott-blog
fix 404
This commit is contained in:
parent
2d6e58d41d
commit
05302c3b04
6
app.js
6
app.js
@ -289,6 +289,12 @@ app.get('/rss', (req, res) => {
|
|||||||
res.send(rssFeed);
|
res.send(rssFeed);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Create a URL object from the environment variable
|
||||||
|
const blog_URL = new URL(process.env.BLOG_URL);
|
||||||
|
|
||||||
|
// Extract just the hostname (e.g., blog.raven-scott.fyi)
|
||||||
|
const hostname = blog_URL.hostname;
|
||||||
|
|
||||||
// Global 404 handler for unmatched routes
|
// Global 404 handler for unmatched routes
|
||||||
app.use((req, res) => {
|
app.use((req, res) => {
|
||||||
if (req.hostname === hostname) {
|
if (req.hostname === hostname) {
|
||||||
|
Loading…
Reference in New Issue
Block a user