Skip to content
Snippets Groups Projects
Unverified Commit 62945f06 authored by Chocobozzz's avatar Chocobozzz
Browse files

Add cors for static paths too

parent 0f7fedc3
No related branches found
No related tags found
No related merge requests found
......@@ -114,22 +114,11 @@ import { UpdateVideosScheduler } from './server/lib/schedulers/update-videos-sch
// Enable CORS for develop
if (isTestInstance()) {
app.use((req, res, next) => {
// These routes have already cors
if (
req.path.indexOf(STATIC_PATHS.TORRENTS) === -1 &&
req.path.indexOf(STATIC_PATHS.WEBSEED) === -1 &&
req.path.startsWith('/api/') === false
) {
return (cors({
origin: '*',
exposedHeaders: 'Retry-After',
credentials: true
}))(req, res, next)
}
return next()
})
app.use(cors({
origin: '*',
exposedHeaders: 'Retry-After',
credentials: true
}))
}
// For the logger
......
......@@ -8,6 +8,8 @@ import { VideosCaptionCache } from '../lib/cache/videos-caption-cache'
const staticRouter = express.Router()
staticRouter.use(cors())
/*
Cors is very important to let other servers access torrent and video files
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment