diff options
-rw-r--r-- | server.ts | 34 |
1 files changed, 16 insertions, 18 deletions
@@ -84,24 +84,22 @@ import { UpdateVideosScheduler } from './server/lib/schedulers/update-videos-sch | |||
84 | 84 | ||
85 | // ----------- App ----------- | 85 | // ----------- App ----------- |
86 | 86 | ||
87 | // Enable CORS for develop | 87 | // Enable CORS |
88 | if (isTestInstance()) { | 88 | app.use((req, res, next) => { |
89 | app.use((req, res, next) => { | 89 | // These routes have already cors |
90 | // These routes have already cors | 90 | if ( |
91 | if ( | 91 | req.path.indexOf(STATIC_PATHS.TORRENTS) === -1 && |
92 | req.path.indexOf(STATIC_PATHS.TORRENTS) === -1 && | 92 | req.path.indexOf(STATIC_PATHS.WEBSEED) === -1 |
93 | req.path.indexOf(STATIC_PATHS.WEBSEED) === -1 | 93 | ) { |
94 | ) { | 94 | return (cors({ |
95 | return (cors({ | 95 | origin: '*', |
96 | origin: '*', | 96 | exposedHeaders: 'Retry-After', |
97 | exposedHeaders: 'Retry-After', | 97 | credentials: true |
98 | credentials: true | 98 | }))(req, res, next) |
99 | }))(req, res, next) | 99 | } |
100 | } | 100 | |
101 | 101 | return next() | |
102 | return next() | 102 | }); |
103 | }) | ||
104 | } | ||
105 | 103 | ||
106 | // For the logger | 104 | // For the logger |
107 | app.use(morgan('combined', { | 105 | app.use(morgan('combined', { |