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!

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则