Sfoglia il codice sorgente

修正正式地址->CORS跨域: request.getHeader("Origin")=null时设置前端的地址

csg6 1 settimana fa
parent
commit
5ab1a57f21

+ 5 - 2
ruoyi-common/src/main/java/com/ruoyi/common/filter/RestCorsFilter.java

@@ -31,13 +31,16 @@ public class RestCorsFilter implements Filter {
31 31
                 "http://10.152.72.7:8181" // 岗检前端Nginx
32 32
                 // "*.cnooc.*"
33 33
                 // TODO 打包屏蔽-甲方部署时注释:甲方不需要本地登录功能采用单点登录
34
-                , "http://192.168.3.32:81"  // 前端开发
34
+//                , "http://192.168.3.32:81"  // 前端开发
35 35
         };
36 36
         Set<String> allowedOrigins = new HashSet<>(Arrays.asList(allowDomain));
37 37
         String originHeader = request.getHeader("Origin");
38 38
 
39
+        //前端的头Origin为空时设置为前端Nginx的地址
40
+        //前端跳转方式:src/views/postcheck.vue -> window.location.href = `${this.getBaseUrl()}/redirectpostcheck`;
39 41
         if (StringUtils.isBlank(originHeader)) {
40
-            originHeader = "http://192.168.3.32:81";
42
+//            originHeader = "http://192.168.3.32:81";
43
+            originHeader = "http://10.152.72.7:8181";
41 44
         }
42 45
 
43 46
         if (allowedOrigins.contains(originHeader)) {