Skip to content

Commit

Permalink
src/campaign-file: Set Cache-Control
Browse files Browse the repository at this point in the history
This would allow for images to be cached on the client.
Age of cache  is set to 6 months.

Test:
1. Open Browser's devtools
2. Go to network tab
3. Refresh page
4. Campaign files should be loaded through disk cache
  • Loading branch information
sashko9807 committed Aug 22, 2023
1 parent b2fc503 commit 77c5b24
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions apps/api/src/campaign-file/campaign-file.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
Body,
Inject,
forwardRef,
Header,
} from '@nestjs/common'
import { FilesInterceptor } from '@nestjs/platform-express'
import { UseInterceptors, UploadedFiles } from '@nestjs/common'
Expand Down Expand Up @@ -78,6 +79,7 @@ export class CampaignFileController {

@Get(':id')
@Public()
@Header('Cache-Control', 'public, s-maxage=15552000, stale-while-revalidate=15552000, immutable')
async findOne(
@Param('id') id: string,
@Response({ passthrough: true }) res,
Expand Down

0 comments on commit 77c5b24

Please sign in to comment.