Geo redir breaks every 1/2hour or so

We have a site running a bunch of Geo redirects rule (all 200)

Here is a short version of the produced _redirects file.

# Redirect default Netlify subdomain to primary domain
https://boralex.netlify.com/* https://www.boralex.com/:splat 301!

# /projects/* /our-projects-and-sites/
# /projets/* /fr/nos-sites-et-projets/

/investors/growth-strategy/ /investors/growth-strategy/ug1.html 200 Country=us
/fr/investisseurs/strategie-de-croissance/ /fr/investisseurs/strategie-de-croissance/ug1.html 200 Country=us
/fr/investisseurs/pourquoi-investir/ /fr/investisseurs/pourquoi-investir/ug1.html 200 Country=us
/investors/why-invest/ /investors/why-invest/ug1.html 200 Country=us
/fr/ /fr/ug1.html 200 Country=us
/blocks/ /blocks/ug1.html 200 Country=us
/project-document-niagara-region/ /project-document-niagara-region/ug1.html 200 Country=us
/project-document-portryerse/ /project-document-portryerse/ug1.html 200 Country=us
/project-document-yellow-falls/ /project-document-yellow-falls/ug1.html 200 Country=us
/fr/project-document-niagara-region/ /fr/project-document-niagara-region/ug1.html 200 Country=us
/fr/project-document-portryerse/ /fr/project-document-portryerse/ug1.html 200 Country=us
/fr/project-document-yellow-falls/ /fr/project-document-yellow-falls/ug1.html 200 Country=us
/ /ug1.html 200 Country=us
[ more rules ... ] 
/fr/contact/ /fr/contact/ug2.html 200 Country=fr
/our-commitments/ /our-commitments/ug2.html 200 Country=fr
/our-energy-sources/ /our-energy-sources/ug2.html 200 Country=fr
/fr/qui-sommes-nous/ /fr/qui-sommes-nous/ug2.html 200 Country=fr
/fr/tags/ /fr/tags/ug2.html 200 Country=fr
/tags/ /tags/ug2.html 200 Country=fr
/who-we-are/ /who-we-are/ug2.html 200 Country=fr
/fr/investisseurs/evenements-et-presentations/ /fr/investisseurs/evenements-et-presentations/ug2.html 200 Country=fr
/newsroom/ /newsroom/ug2.html 200 Country=fr
/fr/salle-de-presse/ /fr/salle-de-presse/ug2.html 200 Country=fr
/fr/nos-sites-et-projets/ /fr/nos-sites-et-projets/ug2.html 200 Country=fr
/our-projects-and-sites/ /our-projects-and-sites/ug2.html 200 Country=fr

The above does not appear to have any problem at least not run through Netlify's playground.

Now for some reason, after 30 minutes or so following a deploy, those georules (all or some) will stop working.

We’ve tested many configuration. And stripped the redirect files to a minimum to avoid any conflict.

As of now, the only solution to fix the issue seems to be to trigger a deploy of the site. This seems to “refresh” the rules or something.

cc/ @budparr

1 Like

Now there is something that might cause trouble. I’m using a 200 code, which means the rewrite is not forced. So for this one:

/fr/contact/ /fr/contact/ug2.html 200 Country=fr

We do have a /fr/contact/index.html so if found, I guess the rewrite should not happen. Yet, it does happen most of the time, until it does not, and then it all it take is a redeploy of the site.

Maybe a conflict between the browser’s default resolution of index.html for any directory and this 200 status code…

I’m lost :man_shrugging:

1 Like

That does seem like it would cause some problems, Regis. You mentioned in the helpdesk that perhaps things started working better when you reconfigured things based on that realization - what configuration did you end up with?

First we limited the printing of rules only pages stricly needing it to avoiding possible unnecessary breaking rules.

But mostly we removed the trailing slash in the origin url (as per documentation) and forced the redirect with !
From this

/investors/governance/ /investors/governance/ug1.html 200 Country=us

To this:

/investors/governance /investors/governance/ug1.html 200! Country=us

But you still have an index.html in /investors/governance, it seems like? I’m glad to hear it is working well, but I am not certain that it will always work well. If you’ve seen it working well, great! Trailing slashes are tough on netlify (and on site visitors - sometimes people type them or don’t, even if you create all the links correctly on your own pages).

Forcing redirects where possible is definitely a useful trick to reducing complexity in how we parse them, so that was a good instinct :slight_smile:

Yes for users not from the US, we serve the index.html (no redirect rules needed) which I guess Netlify/browser can resolve itself from /investors/governance/ but for visitors from the US we serve /investors/governance/ug1.html

That’s why I forced the redirect, to make sure it happened to US visitors even though there was a page available at /investors/governance/.

Can you tell me what make you think that, and how this could be addressed?

Hi @regisphilibert,
We’ve been facing a very similar problem as you. Interestingly, our redirects were working for over a year and then we started experiencing very similar symptoms as you have outlined.

We found a really strange behaviour that if we went in and cleared cookies (that were being set by Google Analytics, Facebook, intercom and few other services) via the inspector then the reloaded the page, it would refresh and the geo would work again, but only once as the cookies we set again by these services. Would be keen to see if you can reproduce this under your old configuration. Do you have any cookies being set on your site, not including nf_country by Netlify?

Interesting that you’ve found a workaround with the trailing slash. However, this shouldn’t be the expected behaviour at all.

Mmm I believed my workaround was the forced redirect (!) :slight_smile: But who knows. I’ll look into our cookies configuration.