Cache Query parameter in AWS Cloudfront — Part 1

  • None(Improve caching)
  • Forward All, Cache based on all
  • Forward All, Cache based on whitelist
  • The first option: None (Improve caching) should not be used because we have many request parameter which needs to be sent to AEM
  • We have to allow ignoreUrl parameter in the dispatcher otherwise Cache-Control header cannot be set by Apache. One possibility is that we can set Cache-Control via AEM Sling filter and the dispatcher will create a header file (en.html.h) and add Cache-Control info inside of it but in this case, we have to maintain a separate list of allowed parameters which is not very good in terms of maintainability.
  • The query parameter value should be always in lowercase because for example a parameter ?color=Red and ?color=red will cause Cloud-Front to cache two different objects. Our code should always support lower-case and to make sure values entered by the end-users are always in lowercase, we need to write Lambda@Edge to pass lowercase always to the origin server.
  • My suggestion will be to use “Forward all, cache based on all” because we do not have to maintain a separate list of allowed query parameters, and also most importantly if we do not know the query parameters and have 301 redirects then we will get an infinite loop, more details here:

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Cinematic Stealth Project — Loading Scene #13

P2E: The Lost Treasure Updated

Counter XSS with Spring Cloud Gateway

Deploying a static website via GitLab CI/CD and Docker to the remote VPS

Using InterServer nameservers from domain manager

Getting started Ruby on Rails for Mac

Coding Tips for School You Cannot Live Without

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Sumanta pakira

Sumanta pakira

More from Medium

Serverless Architecture

Design for Highly-Available Database Using Amazon Aurora

Amazon API Gateway HTTP Errors

Primary Key Design In AWS DynamoDB

Primary Key Design In AWS DynamoDB