Skip to content

Commit

Permalink
Merge pull request #34 from TEAM-MODDY/feat/#27
Browse files Browse the repository at this point in the history
[feat] CORS 관련 config 파일 작성
  • Loading branch information
hellozo0 authored Jan 8, 2024
2 parents bb42dee + f9e0015 commit 643604e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/main/java/com/moddy/server/config/cors/WebConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.moddy.server.config.cors;

import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
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("/**")
.allowedOriginPatterns("*")
.allowedMethods(HttpMethod.GET.name(), HttpMethod.POST.name(), HttpMethod.PUT.name(), HttpMethod.DELETE.name())
.allowedHeaders("Authorization", "Content-Type")
.allowCredentials(true)
.maxAge(3000);
}
}

0 comments on commit 643604e

Please sign in to comment.