diff --git a/backend/src/main/java/de/szut/casino/config/CorsConfig.java b/backend/src/main/java/de/szut/casino/config/CorsConfig.java new file mode 100644 index 0000000..bb86099 --- /dev/null +++ b/backend/src/main/java/de/szut/casino/config/CorsConfig.java @@ -0,0 +1,15 @@ +package de.szut.casino.config; + +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +public class CorsConfig implements WebMvcConfigurer { + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") + .allowedOrigins("http://localhost:4200", "http://192.168.176.120:4200") + .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") + .allowedHeaders("*") + .allowCredentials(true) + .maxAge(3600); + } +}