CORS header rule adjusted

Signed-off-by: Benny Samir Hierl <bennysamir@posteo.de>
This commit is contained in:
Benny Samir Hierl 2022-02-05 07:55:36 +01:00
parent aeff0dd6f0
commit 50a201d6dc

View file

@ -16,7 +16,10 @@ export default async (opts: FastifyContextConfig = {}) => {
})
await app.register(cors, {
origin: true,
origin:
process.env.NODE_ENV === 'development'
? /https?:\/\/localhost(:\d+)?/
: false,
})
await app.register(compress)