Skip to content

Commit

Permalink
feat: CORS 설정, 배포 서버 도메인 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
bflykky committed Jul 31, 2024
1 parent 50b1d18 commit d5364e5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public OpenAPI openAPI() {
SecurityRequirement securityRequirement = new SecurityRequirement().addList("bearerAuth");

Server server = new Server();
server.setUrl("https://www.naoman.site");
server.setUrl("https://naoman.site");

Server local = new Server();
local.setUrl("http://localhost:8080");
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/com/umc/naoman/global/config/WebMvcConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.umc.naoman.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 WebMvcConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOriginPatterns("*")
.allowCredentials(true)
.allowedMethods("GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS")
.allowedHeaders("*")
.maxAge(3600);
}
}

0 comments on commit d5364e5

Please sign in to comment.