From 44d8353a5466c931357b9ed80287a6dcb65fc28a Mon Sep 17 00:00:00 2001 From: vertoryao Date: Thu, 24 Apr 2025 14:49:49 +0800 Subject: [PATCH] =?UTF-8?q?feat(dify):=20=E6=B7=BB=E5=8A=A0=E8=B7=A8?= =?UTF-8?q?=E5=9F=9F=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../zsc/edu/dify/framework/WebMvcConfiguration.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/com/zsc/edu/dify/framework/WebMvcConfiguration.java b/src/main/java/com/zsc/edu/dify/framework/WebMvcConfiguration.java index a2608a8..654e36b 100644 --- a/src/main/java/com/zsc/edu/dify/framework/WebMvcConfiguration.java +++ b/src/main/java/com/zsc/edu/dify/framework/WebMvcConfiguration.java @@ -6,6 +6,7 @@ import org.springframework.boot.autoconfigure.web.WebProperties; import org.springframework.context.annotation.Configuration; import org.springframework.core.io.Resource; import org.springframework.lang.NonNull; +import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.resource.PathResourceResolver; @@ -44,4 +45,13 @@ public class WebMvcConfiguration implements WebMvcConfigurer { return resource; } } + + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") + .allowCredentials(true) + .allowedOrigins("*") + .allowedMethods("*") + .allowedHeaders("*"); + } }