ostark / upper

Integrates Edge Caches like Fastly, KeyCDN, Cloudflare and Varnish with Craft.
MIT License
102 stars 22 forks source link

Using upper with craft CMS multi-site with two domains #47

Open toddpadwick opened 3 years ago

toddpadwick commented 3 years ago

Our site has two domains that return different Craft Multi-sites - a .com domain and a .co.uk domain. We've set up a Cloudflare domain for each. How do we use Upper for both of them? From what I can see there is only room for a single CF domain?

ostark commented 3 years ago

Sorry, that's not supported yet. But shouldn't be hard to implement.

toddpadwick commented 3 years ago

Ah okay. Do you know of a temporary solution? We're finally launching that 'The Writer' site this afternoon, and the client is noticing that any time they make CMS changes, they don't update on the front end. And it's not feasible for me to purge CF manually every time. I thought that Craft's native template header would invalid the cache header out of the box, but obviously not :(

philipzaengle commented 3 years ago

This would be very nice to have :)

ostark commented 3 years ago

@philipzaengle @toddpadwick Can you provide more details? What's needed to make it happen? Multiple tokens / zone-ids too? What's the expected purge behaviour?

philipzaengle commented 3 years ago

@ostark I've not looked at the implementation details of this, so take everything with a grain of salt. But here's my usecase.

Nerd Stuff: I've got craft managing the content of multiple sites, all using different domains. In my case, these are within the same Cloudflare account -- however, I could see larger clients wanting to use domains from multiple Cloudflare accounts (clients amirite?). This would mean all conf needs to be controlled on a per-site basis -- API-key, zone-id, and domain.

CMS user stuff: As a CMS user, I would expect that Upper be aware of the site/entry I'm editing and correctly pure the caches. This, of course, is more complicated than it seems due to the flexible nature of Crafts content propagation. I suppose the best solution would be for a purge propagation config option, but the level of effort there seems high.

Solution stuff: My approach would be to move all settings to a config/upper.php where users could define their settings on a per-site basis.

Sidebar: you're giving this away, so I have zero expectations of this being built / or being a priority. :) If I had the time right now, I'd be submitting a PR.

adrienne commented 3 years ago

@ostark - I have the same problem. Two basically separate sites being run from the same multi-site setup. Would like to just be able to configure multiple zone IDs (in our case the same token works fine but multiple tokens is probably also good) and assign each to a Site ID in Craft (so that entries and sections for that site would purge the relevant zone cache).

ashleybaird commented 3 years ago

@ostark This is an issue I am struggling with now too. Our website is localizing and uses Fastly for caching. We plan to add new domains for each area we are expanding into. Though for our new domain the only way we can purge the cache is by running a Jenkins job to purge the cache of the whole site. This is not sustainable and I was wondering do you plan to add support for multiple Fastly services?