Skip to content

Commit

Permalink
[chore] CORS 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
pkl0912 committed Aug 26, 2024
1 parent ddb4d69 commit 3086019
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/main/java/com/example/letscareer/common/config/WebConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.example.letscareer.common.config;

import lombok.RequiredArgsConstructor;
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
@RequiredArgsConstructor
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 3086019

Please sign in to comment.