mirror of
https://github.com/chatopera/cosin.git
synced 2025-08-01 16:38:02 +08:00
Closed https://github.com/chatopera/cskefu/issues/703 fix cors problem
This commit is contained in:
parent
1c1f7b36a2
commit
fad9d7c293
@ -21,20 +21,32 @@ import com.chatopera.cc.interceptor.LogIntercreptorHandler;
|
|||||||
import com.chatopera.cc.interceptor.UserExperiencePlanInterceptorHandler;
|
import com.chatopera.cc.interceptor.UserExperiencePlanInterceptorHandler;
|
||||||
import com.chatopera.cc.interceptor.UserInterceptorHandler;
|
import com.chatopera.cc.interceptor.UserInterceptorHandler;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
public class CSKeFuWebAppConfigurer
|
public class CSKeFuWebAppConfigurer
|
||||||
extends WebMvcConfigurerAdapter {
|
extends WebMvcConfigurerAdapter {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addCorsMappings(CorsRegistry registry) {
|
||||||
|
registry.addMapping("/**");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInterceptors(InterceptorRegistry registry) {
|
public void addInterceptors(InterceptorRegistry registry) {
|
||||||
// 多个拦截器组成一个拦截器链
|
// 多个拦截器组成一个拦截器链
|
||||||
// addPathPatterns 用于添加拦截规则
|
// addPathPatterns 用于添加拦截规则
|
||||||
// excludePathPatterns 用户排除拦截
|
// excludePathPatterns 用户排除拦截
|
||||||
registry.addInterceptor(new UserExperiencePlanInterceptorHandler()).addPathPatterns("/**").excludePathPatterns("/im/**","/res/image*","/res/file*","/cs/**","/messenger/webhook/*");
|
registry.addInterceptor(new UserExperiencePlanInterceptorHandler()).addPathPatterns("/**").excludePathPatterns("/im/**", "/res/image*", "/res/file*", "/cs/**", "/messenger/webhook/*");
|
||||||
registry.addInterceptor(new UserInterceptorHandler()).addPathPatterns("/**").excludePathPatterns("/login.html","/im/**","/res/image*","/res/file*","/cs/**","/messenger/webhook/*");
|
registry.addInterceptor(new UserInterceptorHandler()).addPathPatterns("/**").excludePathPatterns("/login.html", "/im/**", "/res/image*", "/res/file*", "/cs/**", "/messenger/webhook/*");
|
||||||
registry.addInterceptor(new CrossInterceptorHandler()).addPathPatterns("/**");
|
registry.addInterceptor(new CrossInterceptorHandler()).addPathPatterns("/**");
|
||||||
registry.addInterceptor(new LogIntercreptorHandler()).addPathPatterns("/**");
|
registry.addInterceptor(new LogIntercreptorHandler()).addPathPatterns("/**");
|
||||||
super.addInterceptors(registry);
|
super.addInterceptors(registry);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user