aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--server.ts21
-rw-r--r--server/controllers/static.ts2
2 files changed, 7 insertions, 16 deletions
diff --git a/server.ts b/server.ts
index a688bb5d0..7dffb6576 100644
--- a/server.ts
+++ b/server.ts
@@ -114,22 +114,11 @@ import { UpdateVideosScheduler } from './server/lib/schedulers/update-videos-sch
114 114
115// Enable CORS for develop 115// Enable CORS for develop
116if (isTestInstance()) { 116if (isTestInstance()) {
117 app.use((req, res, next) => { 117 app.use(cors({
118 // These routes have already cors 118 origin: '*',
119 if ( 119 exposedHeaders: 'Retry-After',
120 req.path.indexOf(STATIC_PATHS.TORRENTS) === -1 && 120 credentials: true
121 req.path.indexOf(STATIC_PATHS.WEBSEED) === -1 && 121 }))
122 req.path.startsWith('/api/') === false
123 ) {
124 return (cors({
125 origin: '*',
126 exposedHeaders: 'Retry-After',
127 credentials: true
128 }))(req, res, next)
129 }
130
131 return next()
132 })
133} 122}
134 123
135// For the logger 124// For the logger
diff --git a/server/controllers/static.ts b/server/controllers/static.ts
index 679999859..1600068e0 100644
--- a/server/controllers/static.ts
+++ b/server/controllers/static.ts
@@ -8,6 +8,8 @@ import { VideosCaptionCache } from '../lib/cache/videos-caption-cache'
8 8
9const staticRouter = express.Router() 9const staticRouter = express.Router()
10 10
11staticRouter.use(cors())
12
11/* 13/*
12 Cors is very important to let other servers access torrent and video files 14 Cors is very important to let other servers access torrent and video files
13*/ 15*/