enhance
This commit is contained in:
parent
540ee04816
commit
70d7516b8e
8
app.js
8
app.js
@ -313,9 +313,15 @@ 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 === 'blog.raven-scott.fyi') {
|
if (req.hostname === hostname) {
|
||||||
res.redirect(process.env.HOST_URL);
|
res.redirect(process.env.HOST_URL);
|
||||||
} else {
|
} else {
|
||||||
res.redirect('/');
|
res.redirect('/');
|
||||||
|
Loading…
Reference in New Issue
Block a user