소스 검색

fix forbidden error

Signed-off-by: ruiyi.jiang <ruiyi.jiang@zilliz.com>
ruiyi.jiang 2 년 전
부모
커밋
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();
 };