-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5374e48
commit 20be042
Showing
3 changed files
with
36 additions
and
25 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
jaknaeso-server/src/main/java/org/nexters/jaknaesoserver/config/CorsConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package org.nexters.jaknaesoserver.config; | ||
|
||
import java.util.List; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.web.cors.CorsConfiguration; | ||
import org.springframework.web.cors.CorsConfigurationSource; | ||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource; | ||
|
||
@Configuration | ||
public class CorsConfig { | ||
|
||
private static final String LOCAL_URL = "http://localhost:3000"; | ||
private static final String JAKNAESO_WEB_VERCEL_APP = "https://jaknaeso-web.vercel.app"; | ||
|
||
@Value("${cors.origins.api-doc}") | ||
private String API_DOC_HOST; | ||
|
||
@Bean | ||
public CorsConfigurationSource corsConfigurationSource() { | ||
|
||
final CorsConfiguration corsConfiguration = new CorsConfiguration(); | ||
corsConfiguration.setAllowedOrigins(List.of(API_DOC_HOST, LOCAL_URL, JAKNAESO_WEB_VERCEL_APP)); | ||
corsConfiguration.setAllowedMethods(List.of("GET", "POST", "PUT", "PATCH", "DELETE")); | ||
corsConfiguration.addAllowedHeader("*"); | ||
corsConfiguration.setAllowCredentials(true); | ||
|
||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); | ||
source.registerCorsConfiguration("/**", corsConfiguration); | ||
return source; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 0 additions & 25 deletions
25
jaknaeso-server/src/main/java/org/nexters/jaknaesoserver/config/WebMvcConfig.java
This file was deleted.
Oops, something went wrong.