We run a German online shop (web application: OXID v6) customer in two languages (German (default) and English).
After flushing cache it sometimes happens that the Homepage is in English on default. That happens if the first user, uses English as website language, and calls the homepage without language prefix like www.domain.tld.
None of your script is going to help if that page is already in Cloudflare’s cache in some other language. It looks like you’re setting a redirect header for that page if the user has a specific Language cookie. And Cloudflare will cache that page along with that header.
Since it looks like you’re setting cookies, can you set a unique cookie for English (or non-German) users? And then you can user a Worker to Bypass Cache on Cookie (or if on Business Plan, it’s built in as a Page Rule feature). Otherwise, you’ll have to add a Page Rule earlier to Bypass cache for just the home page.
Yes, I figured that too. That’s why I’m looking for support.
Just to make sure. - Yes, we are using cookies and I could probably that a certain cookie for non-german but can’t I use the value of the cookie for Bypass on Cookie page rules?
If you’re on a Business plan, or just using the pmeenan script, it’s not the value of the cookie, but just the existence of a cookie by that name. Set the cookie for a different behavior, or don’t cookie for the other behavior.
Thanks for quick support but how should I setup the page rule? So, that German (www.domain.tld) and English (www.domain.tld/en/) both is cached.
And we are using pro plan.
You can’t cache www.domain.tld/ (just the home page) if it’s going to include the redirect header to /en/ for English users.
I don’t understand how the Cookie is set/read. But, speaking of Workers, some scripting there might handle this for you. Here’s an A/B script that uses cookies:
Someone recently set up a page of Cloudflare resources that may include some potential solutions. Maybe @judge or @domjh remember.