I'm trying to figure out how to leverage the CloudFront-Viewer-Country header to customize responses for specific countries. I'm feeling stuck because the documentation isn't very clear. Here's my situation:
- I can't see the header during the viewer request despite making adjustments to my cache and origin policies.
- I can see it on the origin request, but at that point, it's too late to change the cache key.
My goal is to set up just two caches: one for country A and another for the rest of the world. I don't want to end up creating separate caches for each country. Can anyone tell me what I'm missing or the best approach to achieve this?
1 Answer
Setting up your caches this way might be a bit tricky with CloudFront since there isn’t really a separate cache for users by country. Can you clarify what you want to achieve?

I meant that I want to only differentiate between country A and the rest of the world, so I don't want a cache for every individual country. Adding CloudFront-Viewer-Country to the cache key feels like it would just over-complicate things.