-
Notifications
You must be signed in to change notification settings - Fork 42
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
SPA-Routing no longer works properly since Quarkus 3.9 #666
Comments
@mschorsch are you using Quarkus REST or RESTEasy? |
@mschorsch could you create a small reproducer? |
We use Resteasy Reactive (Quarkus REST).
Mmm. Just to be sure, did you enter the URL http://localhost:8080/foo directly or did you navigate there from http://localhost:8080/? The error only occurs for us if the URL http://localhost:8080/foo is entered directly in the browser.
We are trying to create one. |
In the browser
🙏 |
@ia3andy We don't have a reproducer yet, but we have found the problem. If an endpoint is not found, a NotFoundException is thrown. This exception is caught by a custom ExceptionMapper. Since Quarkus 3.9 this means that the NotFoundException is handled by the ExceptionMapper and not by Quinoa. The problem should therefore be easy to reproduce by defining a global ExceptionMapper. |
@ia3andy The problem can be reproduced by using the integrations-tests from quarkus-quinoa.
public class ExceptionMappers {
@ServerExceptionMapper
public Response handleExceptions(WebApplicationException exception) {
return exception.getResponse();
}
}
|
@phillip-kruger @geoand did we change something in Quarkus for this? |
It might be related to the Route on 404 thing that Philip changed |
Yeah, I would advise to wait for 3.9.3 that I will release tomorrow as it might contain a fix for it. @mschorsch You can try building quarkusio/quarkus#39965 and see if it fixes it for you. |
@all-contributors add @mschorsch for bug |
I've put up a pull request to add @mschorsch! 🎉 |
Thanks @gsmet. I've build quarkusio/quarkus#39965 an tested against quarkus-quinoa, it seems that 3.6.3 doesn't fix the issue. Furthermore, I do not see any pull request that could resolve the issue. Maybe I did something wrong or overlooked something :). Let's wait for Quarkus 3.6.3. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment has been minimized.
This comment has been minimized.
This seems like the correct behavior ? Or am I missing something ? |
@phillip-kruger If all REST endpoints are under |
We found the issue, As soon as a ExceptionMapper is set, REST now assume that it should deal with 404. I think we should check the ResumeOn404 option (BuildItem and Config) before throwing the 404. |
I'll have a look. Give me a day |
@phillip-kruger is working on a fix :) |
@mschorsch thanks for reporting and investigating this! |
As a workaround: Define a custom SPA routing handler (e.g. https://docs.quarkiverse.io/quarkus-quinoa/dev/advanced-guides.html#spa-routing). This works as expected. |
@mschorsch nice! Yeah I use RestEasy Classic so I have been using that SPA class so I guess that is why I didn't see the issues! |
Hi all. So I think the current way to handle this (3.9) is correct, and pre-3.9 was wrong. To see the details for this, go to https://github.com/phillip-kruger/quinoa-and-rest/ tldr: Using Quarkus correctly, when using more than one technology on HTTP, you should separate those under different roots: Typically, in this example, you would serve Web content on The pre-3.9 breaks this when using like you want to (Having SPA and a Exception Handler) as even REST endpoint will redirect to index.html. Using Quarkus "incorrectly", i.e sharing both REST and Web on If you want to use the same root (
I hope this help. I'll work with @ia3andy to see if he really want to support the old way, that we add support for that in Quinoa without breaking REST Endpoints. |
@phillip-kruger Thanks for the detailed analysis. If I want to deploy the web content under This should be documented. |
Yes, and your REST code with the annotations ( So |
Perfect :) I can confirm that by setting |
@ia3andy Should we close the issue? |
I changed it to a documentation ticket. I think what @phillip-kruger elaborated on should be somehow added to the docs. |
I have a potentially related (or maybe not) issue here with dynamic routing in nextjs: I've using the Inspecting the state of |
Setting I bisected this in a project of mine (https://gitlab.com/appframework/tasker-web/-/commit/560ad663352ab6f28b54492758184e30ec08371f) |
Describe the bug
We use SPA routing in some of our applications. Since Quarkus 3.9, SPA routing no longer works correctly if the URL is entered directly.
Example: Suppose we have a Quarkus application with a React frontend (the routing in the frontend works via react-router). All Resteasy Reactive REST-API endpoints are located under /api/. If the application is called e.g. http://localhost:8080/ then the SPA routing works correctly. However, if e.g. http://localhost:8080/page1 is entered directly in the browser, we get a 404 instead of the index.html since Quarkus 3.9. Quarkus 3.8.x works as expected.
Does this possibly have something to do with the renaming of the extensions in Quarkus 3.9?
Quinoa version
2.3.6
Quarkus version
3.9.2
Build / Runtime
Create React App (CRA)
Package Manager
YARN
Steps to reproduce the behavior
No response
Expected behavior
No response
The text was updated successfully, but these errors were encountered: