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
已提問 8 個月前檢視次數 233 次
1 個回答
1
已接受的答案

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
專家
Steve_M
已回答 8 個月前
profile picture
專家
已審閱 4 天前
  • Thank you kindly!

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南