提交 cf075ff8 作者: xiaowang

跨域问题解决

上级 7342cf17
package com.mmc.csf.release.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.reactive.CorsWebFilter;
import org.springframework.web.cors.reactive.UrlBasedCorsConfigurationSource;
/**
* @author 作者 geDuo
* @version 创建时间:2021年9月4日 上午9:33:40
* @explain 跨域
*/
@Configuration
public class CorsConfig {
// 添加跨域过滤器
@Bean
public CorsWebFilter corsWebFilter() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
CorsConfiguration config = new CorsConfiguration();
config.addAllowedOrigin("*");
config.setAllowCredentials(true);
config.addAllowedHeader("*");
config.addAllowedMethod("*");
source.registerCorsConfiguration("/**", config);
return new CorsWebFilter(source);
}
}
...@@ -53,8 +53,8 @@ spring: ...@@ -53,8 +53,8 @@ spring:
#Redis #Redis
redis: redis:
database: 0 database: 0
host: 119.23.248.181 host: r-wz9ke310fs684hacn1pd.redis.rds.aliyuncs.com
password: mmc@redis123 password: MMC@2022&REDIS
port: 6379 port: 6379
#连接池 #连接池
lettuce: lettuce:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论