Skip to content

Commit

Permalink
Merge pull request #82 from dionisos198/Fix/#80-solve-cors-error
Browse files Browse the repository at this point in the history
Fix: allowed origin ๋ฐ ๋ฉ”์„œ๋“œ ์ˆ˜์ • (#80)
  • Loading branch information
dionisos198 authored Jan 16, 2024
2 parents 52e204b + ed8a540 commit 32bc29e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/main/java/tavebalak/OTTify/common/config/WebConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ public class WebConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**") // cors๋ฅผ ์ ์šฉํ•  spring์„œ๋ฒ„์˜ url ํŒจํ„ด.
.allowedOrigins("http://ottify.kro.kr:3000") // cors๋ฅผ ํ—ˆ์šฉํ•  ๋„๋ฉ”์ธ. ์ œํ•œ์„ ๋ชจ๋‘ ํ•ด์ œํ•˜๋ ค๋ฉด "**"
.allowedOrigins("http://ottify.kro.kr")//์ƒˆ๋กœ ์ถ”๊ฐ€๋œ ๋ถ€๋ถ„ : ์—ฌ๊ธฐ
.allowedOrigins("http://localhost:3000")
.allowedOrigins("http://ottify.kro.kr:3000", "http://ottify.kro.kr",
"http://localhost:3000") // cors๋ฅผ ํ—ˆ์šฉํ•  ๋„๋ฉ”์ธ. ์ œํ•œ์„ ๋ชจ๋‘ ํ•ด์ œํ•˜๋ ค๋ฉด "**"
.allowedMethods("GET", "POST", "PUT", "PATCH",
"DELETE"); // cors๋ฅผ ํ—ˆ์šฉํ•  method + DELETE ์ถ”๊ฐ€
"DELETE", "OPTIONS"); // cors๋ฅผ ํ—ˆ์šฉํ•  method + DELETE ์ถ”๊ฐ€
}
}

0 comments on commit 32bc29e

Please sign in to comment.