Skip to content

Commit

Permalink
Merge pull request #29 from AmorGakCo/hotfix/#28
Browse files Browse the repository at this point in the history
hotfix: cors 설정
  • Loading branch information
songhaechan authored Aug 15, 2024
2 parents b35b909 + 17d7873 commit 8d684b8
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/main/java/com/amorgakco/backend/global/config/CorsConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.amorgakco.backend.global.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpHeaders;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class CorsConfig implements WebMvcConfigurer {

@Override
public void addCorsMappings(final CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("http://localhost:3000")
.allowedMethods("GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS")
.allowCredentials(true)
.exposedHeaders(HttpHeaders.LOCATION);
WebMvcConfigurer.super.addCorsMappings(registry);
}
}

0 comments on commit 8d684b8

Please sign in to comment.