From ca838b17a560a9e18db6cafaab7f91ce64aa8c9b Mon Sep 17 00:00:00 2001 From: almazlar Date: Sat, 21 Feb 2026 00:02:28 +0300 Subject: [PATCH] feat: Broaden backend CORS mapping to all paths and update frontend API base URL to production. --- backend/src/main/java/com/todo/backend/config/WebConfig.java | 5 +++-- frontend/src/services/api.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/backend/src/main/java/com/todo/backend/config/WebConfig.java b/backend/src/main/java/com/todo/backend/config/WebConfig.java index fc4e766..43a2e45 100644 --- a/backend/src/main/java/com/todo/backend/config/WebConfig.java +++ b/backend/src/main/java/com/todo/backend/config/WebConfig.java @@ -9,8 +9,9 @@ public class WebConfig implements WebMvcConfigurer { @Override public void addCorsMappings(CorsRegistry registry) { - registry.addMapping("/api/**") - .allowedOrigins("http://localhost:5173", "http://localhost:3000", "http://localhost:8081", "http://localhost:80") // Typical Vite/React/Docker ports + registry.addMapping("/**") + .allowedOrigins("http://localhost:5173", "http://localhost:3000", "http://localhost:8081", + "http://localhost:80") // Typical Vite/React/Docker ports .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") .allowedHeaders("*") .allowCredentials(true); diff --git a/frontend/src/services/api.js b/frontend/src/services/api.js index 02c2f8c..e759163 100644 --- a/frontend/src/services/api.js +++ b/frontend/src/services/api.js @@ -1,4 +1,4 @@ -const BASE_URL = 'http://localhost:8082/api/todos'; +const BASE_URL = 'https://todo.almazlar.com/api/todos'; export const getTodos = async () => { const response = await fetch(BASE_URL);