Amplify-console: Custom Cache-Control header does not work

Created on 27 Oct 2020  路  5Comments  路  Source: aws-amplify/amplify-console

Hi,

I followed instructions to add a custom Cache-Control header for every HTTP response. Here is my amplify.yml:

version: 1
frontend:
  phases:
    build:
      commands: []
  artifacts:
    baseDirectory: /assets
    files:
      - '**/*'
  cache:
    paths: []
  customHeaders:
    - pattern: '**/*'
      headers:
        - key: 'Cache-Control'
          value: 'max-age=86400'
    - pattern: '**/*'
      headers:
        - key: 'custom-header'
          value: 'my-value'

After redeploying I do a HTTP request and successfully get custom-header in the response. But Cache-Control has this value: public, max-age=0, s-maxage=2.

Am I missing something?

Thanks for your help.

bug pending-release

All 5 comments

Hi. We were able to recreate this issue and have identified a fix. Will update when we have an ETA.

Hi, do you have an ETA?

I have migrated custom headers following the new documentation

snap

Without success.

I get cache-control: max-age=0 and also a miss from CloudFront.

Hi, we are actively working on rolling out a fix for Cache-Control custom headers unable to be set which should be in all regions within the next few weeks.

@kahdojay Is there any workaround for setting cache control header?
Is there any default cache behaviour we can enforce in the meanwhile?

We are seeing max-age=0 in all requests which means Amplify is pretty much useless, because caching and instant cache-invalidation is the main usecase for many of us.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thedgbrt picture thedgbrt  路  5Comments

hassankhan picture hassankhan  路  4Comments

JIoJIaJIu picture JIoJIaJIu  路  5Comments

nballenger picture nballenger  路  5Comments

kontrol-debug picture kontrol-debug  路  4Comments