Intermittent Redirect Issue with Kinsta Redirect Rules

I am encountering an issue with Kinsta’s redirect rules and would appreciate any advice.

Setup Details:

  • Domain: domain.tld
  • Redirect From: ^/$
  • Redirect To: domain.tld/x
  • Traffic From: Country X
  • HTTP Status Code: 301 - Moved Permanently

Problem: The redirect works about 50% of the time. The other 50% of the time, users from Country X are not redirected to the subsite. Kinsta support has suggested that the issue is related to caching. However, even after clearing the cache, the redirect does not consistently work. It seems to function intermittently—sometimes it works, and then it stops.

Question: Has anyone experienced similar issues with Kinsta’s redirect rules? If so, how did you resolve it? Are there any specific steps or configurations that could help ensure consistent redirects?

Hello @Rami_Zebian :wave:

While it’s fine to wait and see if any members of our community have a suggestion, I would highly advise reaching out to our Support team via chat so they can troubleshoot on site. At this point, we can only guess the cause and never be certain what we are recommending, therefore, I suggest reaching out to chat support.

Kind regards,

Hello Vladimir,

I’ve already contacted support more than once and they always mention that it is a caching issue. That’s why I’m checking with Community. The issue remains unsolved even after clearing cache from:

  1. Kinsta Dashboard (site cache)

  2. Edge Cache

  3. Purge Cache By URL

  4. Cloudflare Dashboard >> Configure Cache >> Purge Cache

Hi again Rami,

I’m sorry to hear there was back and forth, but I still suggest contacting our chat system since we can’t troubleshoot this properly on the forum.

The issue might be the Edge Cache which won’t work correctly with GeoIP rules, since GeoIP rules are on the server and Edge Cache intercepts the request before it reaches the server.

Try disabling Edge Cache, clear all remaining caches and test from a fresh incognito browser.

Should the issue occur again, reach out to our support team in chat.

Kind regards

Hi Vladimir,

I’m sorry to hear there was back and forth, but I still suggest contacting our chat system since we can’t troubleshoot this properly on the forum.

I’ve already done many times. They always say it’s a caching issue without giving a solution.

Try disabling Edge Cache, clear all remaining caches and test from a fresh incognito browser.

I tried so from my CF account but still the same issue. I think it should be done via a “Cache Rule” from Kinsta’s side.

In my network tab, I can see this:

Cache-Control: public, max-age=0, s-maxage=2592000
Cf-Cache-Status: DYNAMIC
Ki-Cache-Type: Edge: 
Ki-Cf-Cache-Status: HIT

So, when the request passes through my CF account, there is no cache. However, on Kinsta’s CF, it’s returning a HIT. As you mentioned, it’s Edge Cache and GeoIP rules. This can’t be solved unless I create a Page Rule (Cache Rule) under Kinsta’s enterprise account.

Hi @Rami_Zebian! Thank you for your reply!

I understand that you are continuing to experience this redirect issue even after modifying the cache rules under your Cloudflare account. I am sorry to hear that this issue is persisting. I understand this is impacting the experience visitors have with your site. I assure you we want to do everything possible to help resolve this problem!

I see from your post above that the Kinsta Edge Cache is still being hit. As my colleague, Vladimir, mentioned I would recommend disabling Edge Caching from within MyKinsta if you have not already tried this. To disable Edge Caching, please navigate to MyKinsta >> WordPress Sites and select your site name. Then, from the left side bar select “Edge caching” and choose the option on the page to disable this cache.

Once Edge Caching is disabled please do monitor your site for any further redirect issues. If you do continue to experience any issue please do not hesitate to reach out to our Support team via live chat from within MyKinsta, or reply to this thread.

We are standing by and happy to help!

Best regards

Hi Andrew,

Thank you for your reply.

Disabling edge cache from the whole site just for the sake of disabling it on one URL (The homepage) is not a very good approach. Why would I not benefit from edge cache and performance benefits on the whole site (except for the homepage). Your approach works, but from a web performance perspective, it’s not a good solution.

Instead of doing this, the easiest way that can sort this issue is creating a “Cache Rule” on Kinsta CF account (Which I don’t have access to and Kinsta support isn’t helping with this unless I move my site to a dedicated server :man_shrugging:). Support mentioned that there is an issue between Geo Redirect and Edge Cache and they are working on it but they can’t give an accurate time for when would this get resolved.

The Cache Rule I’m suggesting to create must do the following:

If URL is equal to domain.tld, ByPass Cache :slightly_smiling_face:

Example:

I tried a lot with support but looks there is some sort of limitation which I understand. The only way I can fix this is by creating the following flow:

  1. Purchasing redirect rules on my Cloudflare account.

  2. Adding my redirect rules under my Cloudflare account.

  3. Deleting redirect rules from MyKinsta.

  4. Keep Edge Cache working on MyKinsta.

Theoretically, this should work. As the redirection would happen at the level of my DNS.

Thanks,

Hi @Rami_Zebian! Thanks for your reply!

I certainly understand your point about disabling Edge Caching causing an impact to site performance. You are correct, that disabling the Edge Cache could impact load times as the cached HTML would not be served from Cloudflare’s edge.

As it turns out however, we are not able to individually exclude pages from Edge Caching on a per site basis at this time. I will certainly submit a feature request however as I see how this could be beneficial!

The rules you have laid out about setting them up under your Cloudflare account could work! In a customer Cloudflare to Kinsta Cloudflare configuration the rules under your own account would be applied first before the request is internally routed on the Cloudflare network to our integration. This is something I would recommend giving a try to see if it works for you.

If you do need any assistance with configuring the rules, or removing the existing ones please don’t hesitate to reach out. We are always standing by and happy to help!

Best regards

@Andrew thank you for your reply. Yes, it works. I had it already setup before I migrated to Kinsta. However, since I have 15 redirect rules, that would require purchasing page rules from CF to get this done. So, if this feature is fixed from Kinsta’s end, that would be awesome.

@Rami_Zebian We have recently made an update to our Cloudflare edge cache that should help address this issue. Additionally, we can implement a custom Nginx rule to exclude 301/302 responses from the cache and only cache HTTP 200 OK responses. I suggest reaching out to Support via chat for more details and to get immediate assistance. :pray: