浏览代码

fix forbidden error

Signed-off-by: ruiyi.jiang <ruiyi.jiang@zilliz.com>
ruiyi.jiang 1 年之前
父节点
当前提交
de701cc966
共有 1 个文件被更改,包括 5 次插入2 次删除
  1. 5 2
      server/src/middlewares/index.ts

+ 5 - 2
server/src/middlewares/index.ts

@@ -29,13 +29,16 @@ export const ReqHeaderMiddleware = (
 
   const CONNECT_URL = `/api/v1/milvus/connect`;
 
-  if (req.url !== CONNECT_URL && !MilvusService.activeMilvusClient) {
+  if (
+    req.url !== CONNECT_URL &&
+    milvusAddress &&
+    !MilvusService.activeMilvusClient
+  ) {
     throw HttpErrors(
       HTTP_STATUS_CODE.FORBIDDEN,
       'Can not find your connection, please check your connection settings.'
     );
   }
-
   next();
 };