Skip to content

Commit

Permalink
Merge pull request #165 from linkloud/refactor/securityCors
Browse files Browse the repository at this point in the history
refactor:cors settings
  • Loading branch information
als904204 authored Oct 7, 2023
2 parents 982ad00 + 97f48c3 commit 145c9d0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 21 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class SecurityConfig {
@Bean
public SecurityFilterChain configure(HttpSecurity http) throws Exception {
return http
.cors()
.cors().configurationSource(corsConfigurationSource())
.and()
.csrf().disable()
.formLogin().disable()
Expand Down Expand Up @@ -60,9 +60,11 @@ public SecurityFilterChain configure(HttpSecurity http) throws Exception {
@Bean
public CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration configuration = new CorsConfiguration();
configuration.setAllowedOrigins(List.of("https://linkloud.io"));
configuration.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE", "PATCH"));
configuration.setAllowedHeaders(List.of("*"));
configuration.addAllowedOrigin("https://linkloud.io");
configuration.addAllowedOrigin("http://localhost:5173");

configuration.addAllowedMethod("*"); // 모든 메소드 허용.
configuration.addAllowedHeader("*");
configuration.setAllowCredentials(true);
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**", configuration);
Expand Down

0 comments on commit 145c9d0

Please sign in to comment.