Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(cloudfront): Cache Policy cannot forward Authorization header. #13441

Closed
apoorvmote opened this issue Mar 6, 2021 · 2 comments
Closed

(cloudfront): Cache Policy cannot forward Authorization header. #13441

apoorvmote opened this issue Mar 6, 2021 · 2 comments
Assignees
Labels
@aws-cdk/aws-cloudfront Related to Amazon CloudFront bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@apoorvmote
Copy link

I am distributing HTTP API with cloudfront distribution and I wanted to forward Authorization Header.

#13408 (comment)

I was told to create cache policy with allow list

I get error Invalid request provided: AWS::CloudFront::CachePolicy

Reproduction Steps

As per the instructions #13408 (comment) I did

new CachePolicy(this, 'apiCachePolicy', {
      defaultTtl: Duration.minutes(0),
      maxTtl: Duration.minutes(0),
      minTtl: Duration.minutes(0),
      headerBehavior: CacheHeaderBehavior.allowList('Authorization'),
    })

So I went to the cloudfront console and added new policy
cachePolicy

What did you expect to happen?

As per documentation https://aws.amazon.com/premiumsupport/knowledge-center/cloudfront-authorization-header/
I should be able to forward Authorization header with cache policy.

What actually happened?

When I set default, max & min ttl to zero then all remaining options are disabled.

Environment

  • CDK CLI Version : 1.92.0
  • Framework Version:
  • Node.js Version: 14.16.0
  • OS : Ubuntu 20.04 WSL2
  • Language (Version): Typescript ~3.9.7

Other


This is 🐛 Bug Report

@njlynch
Copy link
Contributor

njlynch commented Mar 10, 2021

I see you got help in the linked issue; the quick answer is that a cache policy must have some TTL set to non-zero value to allow for any other settings, so setting a maxTTL of 1 second is sufficient.

@njlynch njlynch closed this as completed Mar 10, 2021
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-cloudfront Related to Amazon CloudFront bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

2 participants