(requestOrigin, callback)
| 47 | app.use( |
| 48 | cors({ |
| 49 | origin(requestOrigin, callback) { |
| 50 | const { ORIGIN } = configService.get<Cors>('CORS'); |
| 51 | if (ORIGIN.includes('*')) { |
| 52 | return callback(null, true); |
| 53 | } |
| 54 | if (ORIGIN.indexOf(requestOrigin) !== -1) { |
| 55 | return callback(null, true); |
| 56 | } |
| 57 | return callback(new Error('Not allowed by CORS')); |
| 58 | }, |
| 59 | methods: [...configService.get<Cors>('CORS').METHODS], |
| 60 | credentials: configService.get<Cors>('CORS').CREDENTIALS, |
| 61 | }), |