Skip to content

Commit

Permalink
Chore: cors
Browse files Browse the repository at this point in the history
  • Loading branch information
yumzen committed Aug 5, 2024
1 parent 777bde7 commit 9fbc432
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/main/java/com/codiary/backend/global/config/WebConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.codiary.backend.global.config;

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 WebConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(final CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("http://localhost:3000")
.allowedMethods("GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS") // ํ—ˆ์šฉํ•  HTTP ๋ฉ”์†Œ๋“œ
.allowedHeaders("*") // ํ—ˆ์šฉํ•  ํ—ค๋”
.allowCredentials(true); // ์ž๊ฒฉ ์ฆ๋ช… ํ—ˆ์šฉ
}
}


0 comments on commit 9fbc432

Please sign in to comment.