mirror of
https://github.com/HeyPuter/puter.git
synced 2026-05-29 21:01:27 +00:00
fix: more reliable 404 responses for .api endpoint
Docker Image CI / build-and-push-image (push) Has been cancelled
Maintain Release Merge PR / update-release-pr (push) Has been cancelled
release-please / release-please (push) Has been cancelled
test / test-backend (24.x) (push) Has been cancelled
test / API tests (node env, api-test) (24.x) (push) Has been cancelled
test / puterjs (node env, vitest) (24.x) (push) Has been cancelled
Docker Image CI / build-and-push-image (push) Has been cancelled
Maintain Release Merge PR / update-release-pr (push) Has been cancelled
release-please / release-please (push) Has been cancelled
test / test-backend (24.x) (push) Has been cancelled
test / API tests (node env, api-test) (24.x) (push) Has been cancelled
test / puterjs (node env, vitest) (24.x) (push) Has been cancelled
This fix avoids some situations where a non-existing route hangs instead of responding with 404.
This commit is contained in:
@@ -79,6 +79,13 @@ class WebServerService extends BaseService {
|
||||
return res.sendStatus(200);
|
||||
});
|
||||
|
||||
// Catch-all 404 for unmatched routes (e.g. api subdomain with unknown path)
|
||||
// There seem to be some cases (ex: other subdomains) where this doesn't work
|
||||
// as intended still, but this is an improvement over the previous behavior.
|
||||
app.use((req, res) => {
|
||||
res.status(404).send('Not Found');
|
||||
});
|
||||
|
||||
this.log.debug('web server setup done');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user