Skip to content

Commit

Permalink
chore: :global: cors ์„ค์ • (#7)
Browse files Browse the repository at this point in the history
* chore: timezone seoul ์„ค์ •

* chore: ๊นƒ ํ…œํ”Œ๋ฆฟ ์ถ”๊ฐ€, readme.md ์ถ”๊ฐ€

* chore: ์˜ˆ์™ธ์ฒ˜๋ฆฌ, ์ „์—ญ ํ™˜๊ฒฝ ์„ค์ • ์™ธ

* feat: ๋ฐ์ดํ„ฐ ๋ชจ๋ธ๋ง

* chore: ๐Ÿณ cicd ์„ค์ •

* chore: ๐Ÿณ workflow lowercase ๋กœ ์ˆ˜์ •

* chore: ๋””์Šค์ฝ”๋“œ webhook ํ…Œ์ŠคํŠธ

* chore: :global: cors ์„ค์ •
  • Loading branch information
LEEJaeHyeok97 authored Sep 26, 2024
1 parent 0266b72 commit ee6e8f9
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.goormdari.global.config.security;

import org.apache.http.HttpHeaders;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

private final long MAX_AGE_SECS = 3600;

@Value("${app.cors.allowed-origins}")
private String[] allowedOrigins;

@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins(allowedOrigins)
.allowedMethods("GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS")
.allowedHeaders("*")
.exposedHeaders(HttpHeaders.LOCATION,"Authorization")
.allowCredentials(true)
.maxAge(MAX_AGE_SECS);
}
}

0 comments on commit ee6e8f9

Please sign in to comment.