diff --git a/src/main/java/com/catspot/cors/WebMvcConfig.java b/src/main/java/com/catspot/cors/WebMvcConfig.java new file mode 100644 index 0000000..8b80ca3 --- /dev/null +++ b/src/main/java/com/catspot/cors/WebMvcConfig.java @@ -0,0 +1,15 @@ +package com.catspot.cors; + +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +@Configuration +public class WebMvcConfig implements WebMvcConfigurer { + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/api/**") + .allowedMethods("GET") + .allowedOrigins("http://localhost:5173", "https://catspot-dev.web.app"); + } +}