|
|
@@ -1,7 +1,5 @@
|
|
|
package org.dromara.common.web.config;
|
|
|
|
|
|
-import java.util.List;
|
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.dromara.common.web.handler.GlobalExceptionHandler;
|
|
|
import org.dromara.common.web.interceptor.PlusWebInvokeTimeInterceptor;
|
|
|
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
|
|
@@ -35,11 +33,11 @@ public class ResourcesConfig implements WebMvcConfigurer {
|
|
|
* 跨域配置
|
|
|
*/
|
|
|
@Bean
|
|
|
- public CorsFilter corsFilter(@Value("${security.cors-allowed-origins:http://localhost:[*],http://127.0.0.1:[*]}") List<String> allowedOrigins) {
|
|
|
+ public CorsFilter corsFilter() {
|
|
|
CorsConfiguration config = new CorsConfiguration();
|
|
|
config.setAllowCredentials(true);
|
|
|
- // 设置访问源地址(仅允许配置的本校域名,禁止回显任意 Origin)
|
|
|
- allowedOrigins.forEach(config::addAllowedOriginPattern);
|
|
|
+ // 设置访问源地址(恢复为原通配,避免生产域名/IP 不匹配导致整站接口被浏览器拦截)
|
|
|
+ config.addAllowedOriginPattern("*");
|
|
|
// 设置访问源请求头
|
|
|
config.addAllowedHeader("*");
|
|
|
// 设置访问源请求方法
|