Skip to content
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

Vite 5: Returns 200 OK instead of 404 Not Found #574

Closed
melloware opened this issue Nov 27, 2023 · 1 comment · Fixed by #593
Closed

Vite 5: Returns 200 OK instead of 404 Not Found #574

melloware opened this issue Nov 27, 2023 · 1 comment · Fixed by #593
Assignees
Labels
bug Something isn't working
Milestone

Comments

@melloware
Copy link
Contributor

melloware commented Nov 27, 2023

Vite 5 now fails because by default appType: 'spa' does not return 404's if something isn't found and returns 200 and sends to index HTML bypassing the SPARouting.

https://vitejs.dev/config/shared-options#apptype

To fix it we need to tell vite this is a MultiPageApplication using appType: 'mpa' to make it work like Vite 4 with Quinoa.

import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";
import eslint from "vite-plugin-eslint";

// https://vitejs.dev/config/
export default defineConfig({
	plugins: [react(), eslint()],
	appType: "mpa",
});
@melloware melloware added the documentation Improvements or additions to documentation label Nov 27, 2023
melloware added a commit to melloware/quarkus-quinoa that referenced this issue Nov 27, 2023
@melloware melloware self-assigned this Nov 27, 2023
@melloware
Copy link
Contributor Author

melloware commented Nov 28, 2023

OK attached is a reproducer:
vite5-project.zip

Run mvn quarkus:dev and then go to DevUI Swagger and just try and hit the "/hello" REST service you will see it returns the HTML of the Vite webapp with a 200 OK.

image

Now go into vite.config.ts and change appType: "spa" to appType: "mpa" and repeat above the RestEasy /hello API works fine again as does the webapp.

melloware added a commit to melloware/quarkus-quinoa that referenced this issue Dec 7, 2023
@melloware melloware added bug Something isn't working and removed documentation Improvements or additions to documentation labels Dec 18, 2023
@melloware melloware changed the title Vite 5: Update Docs Vite 5: Returns 200 OK instead of 404 Not Found Dec 18, 2023
@melloware melloware assigned ia3andy and unassigned melloware Dec 18, 2023
@melloware melloware added this to the 2.3.1 milestone Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants