We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 028be56 + e24bdbe commit 5b73f36Copy full SHA for 5b73f36
1 file changed
src/main/java/com/eventara/config/SpaForwardingController.java
@@ -0,0 +1,23 @@
1
+package com.eventara.config;
2
+
3
+import org.springframework.stereotype.Controller;
4
+import org.springframework.web.bind.annotation.GetMapping;
5
6
+/**
7
+ * Forwards all non-API, non-static-resource requests to index.html
8
+ * so that React Router can handle client-side routing.
9
+ *
10
+ * Without this, navigating directly to /settings or /rules in the browser
11
+ * would return a Spring Boot 404 instead of loading the SPA.
12
+ */
13
+@Controller
14
+public class SpaForwardingController {
15
16
+ @GetMapping(value = {
17
+ "/",
18
+ "/{path:^(?!api|ws|swagger|v3|webjars|static|assets|favicon\\.ico).*$}/**"
19
+ })
20
+ public String forward() {
21
+ return "forward:/index.html";
22
+ }
23
+}
0 commit comments