-
Notifications
You must be signed in to change notification settings - Fork 168
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
setErrorParameter
of error view with HasErrorParameter<NotFoundException>
called for non-HTML requests
#10965
Comments
I suspect this is the key aspect here. We shouldn't return a navigation response (HTML) for something that isn't a navigation request but rather request something like an image or a stylesheet (based on the accept header in the request), regardless of the error condition. |
It's weird : I cannot reproduce this with the |
I don't see this as a bug in fact.
If I ask So when you ask And this is done by not the same UI instance but it's done by another This behavior doesn't look like a bug for me. And as I mentioned there is no bulletproof way to make this behavior "correct": once you start to describe the exact behavior you will immediately fail with the corner cases. As I said: in this specific example it's only you who knows that The suggestion is : rely on the So OK, I've implemented in the #11334 the logic which create a So the logic is extremely fragile / produces a bug in a corner case and I don't like it. |
The URL is irrelevant. What matters is how or why that URL is requested. I could still use If I have a typo in the browser's address bar, then it's excepted that a new UI instance of created. If I have a typo in the |
The URL is relevant. The The only reason why image has weight So the URI is the only information which matters : everything else is based on it. Anyway:
So : this needs the exact design with the description what and how should be done to handle this properly. |
I agree with Denis. Unless there is a way to do this reliably, we probably should not do it at all as it is not a priority but takes significant time. |
Looking at what accept headers browsers set for resources in https://taskmob.demo.vaadin.com/and https://cookbook.vaadin.com/ applications, one option would be to not serve a text/css,*/*;q=0.1 // chrome + edge
text/css // firefox
image/webp,*/* // firefox
image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8 // chrome + edge But this doesn't solve the problem - it just explicitly checks for these headers. There are probably others that could be included too. And CSS typically doesn't even come through the application server in production. Same is for fonts, which cannot be even detected through accept headers. And |
In which browser is that? I tested with Chrome, where it seems to only vary based on where the URL is used but not based on the contents of the URL. No matter what URL prefix I use (I tested
Scripts and webfonts are indeed difficult to distinguish since at least my Chrome requests those as We don't need to have perfect logic for when to create an UI instance and when not, but the more cases we can avoid confusion, the better.
|
Behaviour in V22 in its default bootstrap mode is different. Created a new issue for that (#12965). In legacy V14 bootstrap mode ( |
For V23 this issue has been fixed in #12571 |
Fix for V14 legacy bootstrap mode for the upcoming V23.1 in #13242. |
This ticket/PR has been released with Vaadin 23.0.2. |
Description of the bug / feature
If a Vaadin 14 application contains a class that
implements HasErrorParameter<NotFoundException>
, thesetErrorParameter
method gets invoked for any request that returns a 404 error, even for e.g. image requests (when the requested image is missing).Minimal reproducible example
PageNotFoundView.java
:OtherView.java
:Expected behavior
setErrorParameter
doesn't get invoked when navigating intoOtherView
Actual behavior
setErrorParameter
gets invoked, even though thePageNotFoundView
is never displayed in the UI. The request for the image also gets atext/html
response, which is against the request's accept string.Versions:
The text was updated successfully, but these errors were encountered: