mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
add 404 error-handling to server
This is all that seems necessary according to Express? Admittedly my first time using it. https://expressjs.com/en/starter/faq.html#how-do-i-handle-404-responses
This commit is contained in:
@ -615,6 +615,12 @@ app.use('/api/backends/scale-alt', scaleAltRouter);
|
||||
app.use('/api/speech', speechRouter);
|
||||
app.use('/api/azure', azureRouter);
|
||||
|
||||
// If all other middlewares fail, send 404 error.
|
||||
const notFoundWebpage = fs.readFileSync('./public/error/url-not-found.html', { encoding: 'utf-8' });
|
||||
app.use((req, res, next) => {
|
||||
res.status(404).send(notFoundWebpage);
|
||||
});
|
||||
|
||||
const tavernUrlV6 = new URL(
|
||||
(cliArguments.ssl ? 'https://' : 'http://') +
|
||||
(listen ? '[::]' : '[::1]') +
|
||||
|
Reference in New Issue
Block a user