-
Notifications
You must be signed in to change notification settings - Fork 297
Description
Various endpoints do handling like that:
var user = users.findLoggedInUser();
if (user == null) {
throw new ResponseStatusException(HttpStatus.FORBIDDEN);
}
that normally results in the proper http responses as spring handles that automatically.
However, with a configuration like that:
server:
error:
path: /server-error
whitelabel:
enabled: false
a specific ErrorHandler is activated that redirects all exceptions to the /error frontend page.
This is wrong on multiple levels, as e.g. api calls should not redirect there. Additionally, in the open-vsx.org deployment, there is additional configuratoin to redirect /error to a static html page. Now when an api endpoint throws an error to indicate e.g. the user it not logged in anymore, the response contains html with status code 200 while it is expected to have json, leading to weird errors in the frontend as well.
We need to make sure that all api endpoints return proper responses and not rely on spring magic wrt ResponseStatusExceptions.