From 861c667eb004e41d3f6b8320232f4983194a735f Mon Sep 17 00:00:00 2001 From: DylanSerkovich Date: Mon, 26 Aug 2024 22:22:41 -0500 Subject: [PATCH] configure cors --- .../gateway/config/security/SecurityConfiguration.java | 7 ------- src/main/resources/application.yml | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/main/java/com/entrevistador/gateway/config/security/SecurityConfiguration.java b/src/main/java/com/entrevistador/gateway/config/security/SecurityConfiguration.java index cc5410b..6bc84bf 100644 --- a/src/main/java/com/entrevistador/gateway/config/security/SecurityConfiguration.java +++ b/src/main/java/com/entrevistador/gateway/config/security/SecurityConfiguration.java @@ -55,13 +55,6 @@ public SecurityWebFilterChain securityFilterChain(@NonNull ServerHttpSecurity ht .permitAll() .anyExchange().authenticated() ) - .cors(corsSpec -> corsSpec.configurationSource(exchange -> { - var config = new org.springframework.web.cors.CorsConfiguration(); - config.setAllowedOrigins(java.util.List.of("*")); - config.setAllowedMethods(java.util.List.of("*")); - config.setAllowedHeaders(java.util.List.of("*")); - return config; - })) .build(); } } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 389bbc0..3b32e2b 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -39,7 +39,7 @@ spring: corsConfigurations: '[/**]': allow-credentials: true - allowed-origins: ${ORIGINS:http://localhost:${server.port},http://localhost:3000} + allowed-origins: ${ORIGINS:http://localhost:${server.port},${FRONT_HOST},http://localhost:3000} allowed-headers: '*' allowed-methods: '*' discovery: