From b8be8c4ca6d7fd4777568cd2dcd1af114f860f9e Mon Sep 17 00:00:00 2001 From: zhchen8 Date: Wed, 14 Jan 2026 18:01:12 +0800 Subject: [PATCH] fix(cors): add proper CORS configuration for content routes --- routers/router.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/routers/router.go b/routers/router.go index e8256cf4..72a3b773 100644 --- a/routers/router.go +++ b/routers/router.go @@ -600,6 +600,10 @@ func initMasterRouter(dep dependency.Dep) *gin.Engine { content := file.Group("content") contentCors := cors.New(cors.Config{ AllowOrigins: []string{"*"}, + AllowMethods: []string{"GET", "HEAD", "OPTIONS"}, + AllowHeaders: []string{"Range", "If-Range", "Authorization", "Content-Type"}, + ExposeHeaders: []string{"Content-Range", "Accept-Ranges", "Content-Length", "Content-Disposition"}, + AllowCredentials: false, // 使用 "*" 时必须为 false }) content.Use(contentCors) {