diff --git a/module-auth/src/main/java/com/inhabas/api/auth/config/ProdCorsConfig.java b/module-auth/src/main/java/com/inhabas/api/auth/config/ProdCorsConfig.java new file mode 100644 index 00000000..05cfb021 --- /dev/null +++ b/module-auth/src/main/java/com/inhabas/api/auth/config/ProdCorsConfig.java @@ -0,0 +1,21 @@ +package com.inhabas.api.auth.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +@Configuration +@Profile("production") +public class ProdCorsConfig implements WebMvcConfigurer { + + @Override + public void addCorsMappings(CorsRegistry registry) { + registry + .addMapping("/**") + .allowedOrigins("https://inhabas.com") + .allowedMethods("OPTIONS", "GET", "POST", "PUT", "DELETE") + .allowedHeaders("Authorization", "Content-Type") + .maxAge(3600); + } +}