import { CallHandler , ExecutionContext , NestInterceptor , RequestMethod , } from '@nestjs/common' ; import { FastifyReply } from 'fastify' ; export class AllowAllCorsInterceptor implements NestInterceptor { intercept ( context , next ) { const handle = next . handle ( ) ; const response = context . switchToHttp ( ) . getResponse ( ) ; const allowedMethods = [ RequestMethod . GET , RequestMethod . HEAD , RequestMethod . PUT , RequestMethod . PATCH , RequestMethod . POST , RequestMethod . DELETE , ] ; const allowedHeaders = [ 'Authorization' , 'Origin' , 'No-Cache' , 'X-Requested-With' , 'If-Modified-Since' , 'Last-Modified' , 'Cache-Control' , 'Expires' , 'Content-Type' , ] ; response . headers ( { 'Access-Control-Allow-Origin' : '*' , 'Access-Control-Allow-Headers' : allowedHeaders . join ( ',' ) , 'Access-Control-Allow-Methods' : allowedMethods . join ( ',' ) , 'Access-Control-Max-Age' : '86400' , } ) ; return handle ; } }