Feasibility of CloudFront caching

0

I've been using CloudFlare for a bit, but have found it too restrictive in terms of customisability without having an enterprise plan. I want to give CloudFront a try, but just want to investigate the feasibility and ease of doing what I need to do before diving into the whole thing.

Basically, I have a site, domain.com, and then several subdomain sites running MediaWiki, *.domain.com. I'd like to always cache domain.com, and need to cache *.domain.com sites based on a variety of things. Firstly, I want to assume that everything can be cached. Then, I need to check if there is a cookie wgSessionUser present (the cookie could have any value, so I'd essentially just like to check for the cookie, it doesn't really matter what the value is, as long as it exists). If the cookie exists, then I'd like to bypass CloudFront and pass the request to the origin—to prevent logged in users being hit by the cache, which causes all sorts of issues. Moreover, I also want to bypass the cache if the url contains specific keywords (such as File:, Special:, etc.).

In my head this is a relatively straight forward thing, but I'm not entirely sure on CloudFront capabilities and how this stacks up with CloudFlare's offerings. Can anyone just let me know if this is feasible, and if so, how difficult?

Tips and help resources appreciated :)

LRZXFT
demandé il y a 8 mois233 vues
1 réponse
1
Réponse acceptée

On the face of it, yes CloudFront can do what it is you are looking for.

Your starting point of "everything can be cached", yes CloudFront can do that.

Checking for the presence (or absence) of a particular cookie falls under CachePolicyCookiesConfig data type https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_CachePolicyCookiesConfig.html

Checking whether any part of the URL matches a specific string would fall under PathPattern within CacheBehavior https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_CacheBehavior.html

profile picture
EXPERT
Steve_M
répondu il y a 8 mois
profile picture
EXPERT
vérifié il y a 4 jours
  • Thank you kindly!

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions