Fix CORS issues in desktop app (#5019)

# Description of Changes
In the 2.0.0 release version, the frontend can't connect to the backend
on my machine because all the network requests 403. I think this is
because of CORS issues, and supposedly these will be fixed by using a
different Spring function, which is more lenient on URL schemes (needs
to allow `tauri://localhost` here, which isn't a standard URL)
This commit is contained in:
James Brunton
2025-11-26 10:02:38 +00:00
committed by GitHub
parent 31b3219169
commit bc11875081

View File

@@ -42,7 +42,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
// Tauri v1 uses tauri://localhost, v2 uses http(s)://tauri.localhost
logger.info("Tauri mode detected - enabling CORS for Tauri protocols (v1 and v2)");
registry.addMapping("/**")
.allowedOrigins(
.allowedOriginPatterns(
"tauri://localhost",
"http://tauri.localhost",
"https://tauri.localhost")