Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#469 [feat] CORS 허용 범위 수정 #470

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion module-api/src/main/java/com/mile/config/WebConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.mile.common.resolver.topic.TopicVariableResolver;
import com.mile.common.resolver.user.UserIdHeaderResolver;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
Expand All @@ -28,11 +29,18 @@ public class WebConfig implements WebMvcConfigurer {
private final DuplicatedInterceptor duplicatedInterceptor;
private final UserIdHeaderResolver userIdHeaderResolver;

@Value("${client.local}")
private String clientLocal;

@Value("${client.deploy}")
private String clientDeploy;

@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*")
.allowedOrigins(clientLocal, clientDeploy)
.allowedMethods("GET", "POST", "DELETE", "PUT", "PATCH", "OPTIONS")
.allowCredentials(true)
.maxAge(3000);
}

Expand Down
Loading