cloudfront Use Origin Cache Headers in object caching

791 views
Skip to first unread message

Spyros Lambrinidis

unread,
Feb 6, 2017, 7:56:24 AM2/6/17
to Terraform
Hi,

I want in one of my cloudfront cache behavious to use my origin cache headers as sent from my server.

However in terraform, the min_ttl, max_ttl and default_ttl is required.

Is there a way to use origin cache headers?

thank you

Teemu Matilainen

unread,
Feb 6, 2017, 9:45:52 AM2/6/17
to terrafo...@googlegroups.com
Hi,

- If the origin sends cache headers, CloudFront uses them, but squeezes the caching time to fit between `min_ttl` and `max_ttl`. So you can set them to e.g. 0 and 31536000. The `default_ttl` setting is not used.
- If the origin doesn't send cache header, CloudFront uses `default_ttl`. The `min_ttl` and `max_ttl` settings are not used.
- Default caching time for errors is 5 minutes, but you can override it by `custom_error_response` blocks
- CloudFront never touches/adds/removes the cache headers that are passed to the client, so none of the above settings affect the clients.

None of this is specific to Terraform.

Cheers,
  - Teemu


--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/terraform/issues
IRC: #terraform-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Terraform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to terraform-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/ef7080f3-d542-4eda-8887-b6544270c73c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Florin Andrei

unread,
Mar 22, 2017, 6:54:16 PM3/22/17
to Terraform
This explanation should be added to the documentation https://www.terraform.io/docs/providers/aws/r/cloudfront_distribution.html

It is otherwise very puzzling why Terraform seems to be missing the Object Caching option (it doesn't, really, but anyone except those who know already all these behavior details will be induced to think that the option is missing).


On Monday, February 6, 2017 at 6:45:52 AM UTC-8, Teemu Matilainen wrote:
Hi,

- If the origin sends cache headers, CloudFront uses them, but squeezes the caching time to fit between `min_ttl` and `max_ttl`. So you can set them to e.g. 0 and 31536000. The `default_ttl` setting is not used.
- If the origin doesn't send cache header, CloudFront uses `default_ttl`. The `min_ttl` and `max_ttl` settings are not used.
- Default caching time for errors is 5 minutes, but you can override it by `custom_error_response` blocks
- CloudFront never touches/adds/removes the cache headers that are passed to the client, so none of the above settings affect the clients.

None of this is specific to Terraform.

Cheers,
  - Teemu

On Mon, Feb 6, 2017 at 2:56 PM, Spyros Lambrinidis <spy...@peopleperhour.com> wrote:
Hi,

I want in one of my cloudfront cache behavious to use my origin cache headers as sent from my server.

However in terraform, the min_ttl, max_ttl and default_ttl is required.

Is there a way to use origin cache headers?

thank you

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/terraform/issues
IRC: #terraform-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Terraform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to terraform-too...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages