Browse Source

fix forbidden error

Signed-off-by: ruiyi.jiang <ruiyi.jiang@zilliz.com>
ruiyi.jiang 1 year ago
parent
commit
de701cc966
1 changed files with 5 additions and 2 deletions
  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`;
   const CONNECT_URL = `/api/v1/milvus/connect`;
 
 
-  if (req.url !== CONNECT_URL && !MilvusService.activeMilvusClient) {
+  if (
+    req.url !== CONNECT_URL &&
+    milvusAddress &&
+    !MilvusService.activeMilvusClient
+  ) {
     throw HttpErrors(
     throw HttpErrors(
       HTTP_STATUS_CODE.FORBIDDEN,
       HTTP_STATUS_CODE.FORBIDDEN,
       'Can not find your connection, please check your connection settings.'
       'Can not find your connection, please check your connection settings.'
     );
     );
   }
   }
-
   next();
   next();
 };
 };