|
|
@@ -19,16 +19,12 @@ public class WebConfig implements WebMvcConfigurer { |
|
|
|
.allowedOrigins( |
|
|
|
"http://localhost", // If you test locally via Nginx at http://localhost |
|
|
|
"http://127.0.0.1", // Sometimes browsers resolve localhost to 127.0.0.1 |
|
|
|
"http://20.2.170.164", // Look like no use |
|
|
|
"http://10.40.0.4", |
|
|
|
"http://20.2.170.164", // IP cloud |
|
|
|
"http://localhost:3000" // If you ever run React dev server directly |
|
|
|
// Add any other specific domains/IPs/ports where your frontend will be hosted |
|
|
|
) |
|
|
|
// You had .exposedHeaders("filename") - keep if you need to read custom response headers |
|
|
|
.exposedHeaders("filename") |
|
|
|
// You had .allowedMethods("GET", "POST", "PUT", "DELETE", "HEAD") - This is missing "OPTIONS" |
|
|
|
.allowedMethods("GET", "POST", "PUT", "DELETE", "HEAD", "OPTIONS") // **** IMPORTANT: Add OPTIONS **** |
|
|
|
// You had .allowedHeaders("*") duplicated - harmless, but the first one is enough |
|
|
|
// .allowedHeaders("*") |
|
|
|
.allowCredentials(true) |
|
|
|
.maxAge(3600); // Recommended: Caches preflight results for 1 hour |
|
|
|
} |
|
|
|