mirror of
https://github.com/vkaelin/LeagueStats.git
synced 2026-03-25 12:57:28 +00:00
feat: add cors
This commit is contained in:
parent
8bb7779edb
commit
f428b77e0e
1 changed files with 12 additions and 2 deletions
|
|
@ -20,7 +20,7 @@ const corsConfig: CorsConfig = {
|
||||||
| you can define a function to enable/disable it on per request basis as well.
|
| you can define a function to enable/disable it on per request basis as well.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
enabled: false,
|
enabled: true,
|
||||||
|
|
||||||
// You can also use a function that return true or false.
|
// You can also use a function that return true or false.
|
||||||
// enabled: (request) => request.url().startsWith('/api')
|
// enabled: (request) => request.url().startsWith('/api')
|
||||||
|
|
@ -44,7 +44,17 @@ const corsConfig: CorsConfig = {
|
||||||
| one of the above values.
|
| one of the above values.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
origin: true,
|
origin: (origin) => {
|
||||||
|
if (process.env.NODE_ENV === 'development') {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
if (origin.includes('leaguestats.gg')) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
},
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue