changed cors config to use env variables

This commit is contained in:
2026-05-10 03:49:41 +02:00
parent 2c766b10a3
commit a8e39d8f09
3 changed files with 16 additions and 7 deletions
@@ -8,13 +8,16 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class CorsConfig implements WebMvcConfigurer {
@Value("${vaessl.frontend-url}")
private String frontendUrl;
@Value("${vaessl.frontend-local-url}")
private String frontendLocalUrl;
@Value("${vaessl.frontend-public-url}")
private String frontendPublicUrl;
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins(frontendUrl, "http://192.168.1.208:5173", "https://5173.code-server.kasuns.website")
.allowedOrigins(frontendLocalUrl, frontendPublicUrl)
.allowedMethods("GET", "POST", "DELETE", "OPTIONS")
.allowedHeaders("Content-Type", "Accept")
.allowCredentials(true);