-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Carapace 1.8 > java.lang.NullPointerException #412
Comments
This exception is about the Filter and it seems that e.getKey().getDomain() returns null. |
According to the stacktrace, the NPE is because hostName (the hostname in the request header HOST) is null |
Yes I agree with you. Probably these requests are http1.0 requests. or simply an incomplete request. In my opinion, in this case we should respond with a "400 Bad request" or in any case the request shouldn't be handled completely. @aluccaroni what do you think about it? |
I was able to reproduce the problem also manually directly from the browser.
As a workaround you can simply create a route that returns 404 or other in case of null Host Header. Something like:
the 404notfound action is an action that returns an html error page with a 404 code. But in my opinion the Fix should be done directly from code. A NullPointerException is not acceptable in this specific case. We can create an specific action BadRequest with errore code 400 and if Header host is not present we can redirect We can handle it as for 404 NotFound. We can create a 400 BadRequest action and if Header host is not present in the request we return a BadRequest error page (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Host) |
In our production setup I have noticed several NPE.
I have no way to reproduce it.
The text was updated successfully, but these errors were encountered: