Skip to content

Commit

Permalink
Merge pull request #42 from dd-jiyun/main
Browse files Browse the repository at this point in the history
fix: cors (#17)
  • Loading branch information
dd-jiyun authored Feb 10, 2024
2 parents 2b3dcb8 + 89a17dc commit 153fb7c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ public class SecurityConfig {
"/swagger-ui/**", "/api-docs", "/swagger-ui-custom.html",
"/v3/api-docs/**", "/api-docs/**", "/swagger-ui.html","/oauth/**"
};
@Value("${cors.allowed-origins}")
String[] corsOrigins;

private final TokenProvider tokenProvider;
private final RedisTemplate<String, String> redisTemplate;
Expand Down Expand Up @@ -59,7 +57,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
public CorsConfigurationSource configurationSource() {
CorsConfiguration configuration = new CorsConfiguration();

configuration.setAllowedOriginPatterns(List.of(corsOrigins));
configuration.setAllowedOriginPatterns(List.of("http://localhost:8080","http://localhost:3000/", "https://titto.world/"));
configuration.setAllowedMethods(List.of("GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"));
configuration.setAllowedHeaders(List.of("*"));
configuration.setExposedHeaders(List.of("Access-Control-Allow-Credentials", "Authorization", "Set-Cookie"));
Expand Down
6 changes: 0 additions & 6 deletions Titto_Backend/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,3 @@ springdoc:
disabled : true
default-consumes-media-type: application/json;charset=UTF-8
default-produces-media-type: application/json;charset=UTF-8

#Cors
cors:
allowed-origins:
- http://localhost:3000
- https://titto.world/

0 comments on commit 153fb7c

Please sign in to comment.