Skip to content

Commit

Permalink
πŸ› CORS 였λ₯˜ μˆ˜μ •
Browse files Browse the repository at this point in the history
- 배포 μ‹œ λ°œμƒν•˜λŠ” CORS 였λ₯˜λ₯Ό μˆ˜μ •ν•˜μ˜€μŠ΅λ‹ˆλ‹€.
  • Loading branch information
Ganghee-Lee-0522 committed Jan 11, 2024
1 parent 35742b3 commit b2a0dc3
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,18 @@ public class CorsConfig {
public CorsFilter corsFilter() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
CorsConfiguration config = new CorsConfiguration();
config.setAllowCredentials(true); // λ‚΄ μ„œλ²„κ°€ 응닡할 λ•Œ json을 jsμ—μ„œ μ²˜λ¦¬ν•  수 있게 할지 μ„€μ •
config.addAllowedOrigin("*"); // λͺ¨λ“  ip에 응닡 ν—ˆμš©
config.addAllowedHeader("*"); // λͺ¨λ“  헀더에 응닡 ν—ˆμš©
config.addAllowedMethod("*"); // λͺ¨λ“  http λ©”μ†Œλ“œμ— μš”μ²­ ν—ˆμš©
config.setAllowCredentials(true);
// config.addAllowedOrigin("*"); // λͺ¨λ“  ip에 응닡 ν—ˆμš©
// config.addAllowedHeader("*"); // λͺ¨λ“  헀더에 응닡 ν—ˆμš©
// config.addAllowedMethod("*"); // λͺ¨λ“  http λ©”μ†Œλ“œμ— μš”μ²­ ν—ˆμš©
// source.registerCorsConfiguration("/api/**", config);

config.addAllowedOrigin("https://kidari.site");
config.addAllowedOrigin("https://api.github.com"); // κΉƒν—ˆλΈŒ API 도메인
config.addAllowedOrigin("https://github.com"); // κΉƒν—ˆλΈŒ 인증 μ„Όν„° 도메인

config.addAllowedHeader("*");
config.addAllowedMethod("*");
source.registerCorsConfiguration("/api/**", config);

return new CorsFilter(source);
Expand Down

0 comments on commit b2a0dc3

Please sign in to comment.