Skip to content
This repository was archived by the owner on Jan 28, 2025. It is now read-only.
This repository was archived by the owner on Jan 28, 2025. It is now read-only.

How to set individual TTL times (Min TTL, Max TLL, Default TTL)? #524

Closed
@mattdell

Description

@mattdell

Following the docs in the Readme there is a section about how to set the ttl

myNextApplication:
  component: serverless-next.js
  inputs:
    cloudfront:
      # this is the cache behaviour for next.js api pages
      api:
        ttl: 10

Cloudfront actually has the options for setting min, max, and default ttl times in the UI:

Screenshot 2020-07-27 at 13 10 17

How would I go about setting the Max TTL only to 31536000?

It seems this was supposed to be fixed in PR #282 since it enables "all cloudfront inputs" but these are missing. Looking through the code, it seems to be a limitation in aws-cloudfront inputs

See how it takes in ttl and then assigns that to min, max, and default? https://github.com/serverless-components/aws-cloudfront/blob/master/lib/getCacheBehavior.js

I have raised an issue there but it doesn't appear to be very active.

Does anyone else have this problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions