has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Credentials' header in the response is '' which must be 'true' when the request's credentials mode is 'include'.

2025. 3. 14. 17:48Java/Spring Boot

credentials: 'include'를 설정하면, 서버에서는 아래와 같이 설정되어야 함

allowCredentials(true) 추가되어야 함

            public void addCorsMappings(CorsRegistry registry) {
                registry.addMapping("/**")
                        .allowedOrigins("도메인1", "도메인2") // Match your HTML server address
                        .allowedMethods("*")
                        .allowedHeaders("*")
                        .allowCredentials(true); 
            }