mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-19 10:24:41 +02:00
Update AllowCors to apply to every request #4497
This commit is contained in:
parent
e25e2b238f
commit
6c63e2131c
1 changed files with 1 additions and 1 deletions
|
@ -240,7 +240,7 @@ class Server {
|
|||
* Running in development allows cors to allow testing the mobile apps in the browser
|
||||
* or env variable ALLOW_CORS = '1'
|
||||
*/
|
||||
if (Logger.isDev || req.path.match(/\/api\/items\/([a-z0-9-]{36})\/(ebook|cover)(\/[0-9]+)?/)) {
|
||||
if (global.AllowCors || Logger.isDev || req.path.match(/\/api\/items\/([a-z0-9-]{36})\/(ebook|cover)(\/[0-9]+)?/)) {
|
||||
const allowedOrigins = ['capacitor://localhost', 'http://localhost']
|
||||
if (global.AllowCors || Logger.isDev || allowedOrigins.some((o) => o === req.get('origin'))) {
|
||||
res.header('Access-Control-Allow-Origin', req.get('origin'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue