|
@@ -1,5 +1,6 @@
|
1
|
1
|
package com.ruoyi.common.filter;
|
2
|
2
|
|
|
3
|
+import com.ruoyi.common.utils.StringUtils;
|
3
|
4
|
import org.springframework.core.Ordered;
|
4
|
5
|
import org.springframework.core.annotation.Order;
|
5
|
6
|
import org.springframework.stereotype.Component;
|
|
@@ -28,13 +29,17 @@ public class RestCorsFilter implements Filter {
|
28
|
29
|
String[] allowDomain = {
|
29
|
30
|
"http://10.152.70.21:8080", // CAS服务器
|
30
|
31
|
"http://10.152.72.7:8181" // 岗检前端Nginx
|
31
|
|
- // "*.cnooc.*"
|
|
32
|
+ // "*.cnooc.*"
|
32
|
33
|
// TODO 打包屏蔽-甲方部署时注释:甲方不需要本地登录功能采用单点登录
|
33
|
|
-// ,"http://192.168.3.32:81" // 前端开发
|
|
34
|
+ , "http://192.168.3.32:81" // 前端开发
|
34
|
35
|
};
|
35
|
36
|
Set<String> allowedOrigins = new HashSet<>(Arrays.asList(allowDomain));
|
36
|
37
|
String originHeader = request.getHeader("Origin");
|
37
|
38
|
|
|
39
|
+ if (StringUtils.isBlank(originHeader)) {
|
|
40
|
+ originHeader = "http://192.168.3.32:81";
|
|
41
|
+ }
|
|
42
|
+
|
38
|
43
|
if (allowedOrigins.contains(originHeader)) {
|
39
|
44
|
response.setHeader("Access-Control-Allow-Origin", originHeader);
|
40
|
45
|
response.setHeader("Access-Control-Allow-Credentials", "true");
|
|
@@ -46,7 +51,7 @@ public class RestCorsFilter implements Filter {
|
46
|
51
|
response.setStatus(HttpServletResponse.SC_FORBIDDEN);
|
47
|
52
|
return;
|
48
|
53
|
}
|
49
|
|
- chain.doFilter(req, res);
|
|
54
|
+ chain.doFilter(req, res);
|
50
|
55
|
}
|
51
|
56
|
|
52
|
57
|
@Override
|