Asterisk-based redirect only partially working

Hi, it’s me again :slight_smile:

We’re having an issue with an asterisk-based redirect:

/  /en/  302  Language=en
/  /fr/  302  Language=fr
/  /en/  302
/* /en/:splat

This works great for everything (i.e. https://mysite.com/yolo gets redirected to https://mysite.com/en/yolo), except our https://mysite.com/enterprise page. If a user visits https://mysite.com/enterprise he/she gets a 404 instead of the redirect to https://mysite.com/en/enterprise. Is there anything wrong with my redirect rules?

It’s the only page that doesn’t work - maybe it has something to do with the path starting with /en as in /ENterprise?

Thanks in advance.

Florian

Ok, here’s an update: I created a new page called https://mysite.com/en/entest and the behaviour is the same as with the /enterprise one. I assume it really has to do with the en in ENterprise and ENtest.

Hi Flo,

Yup, you’ve found a bug where there is an overlap in config paths we sometimes grab the wrong one (/en and /ensomethingelse can become conflated). In the future please give us a real URL so we can see it in action, but in this case, I’ve seen that behavior once before and found the open bug on it to update with your experience, so it didn’t turn out to be necessary.

Present advice would be not to have overlapping redirects like that.

Thanks for your answer, @fool. Sorry for not providing the actual URLs. The one in question is https://www.frontify.com/enterprise. I cleaned up the redirect rules a bit and now we’re only having

/  /fr/  302  Language=fr
/* /en/:splat  302

which works quiet well except for the issue I mentioned. I don’t assume you’re able to provide me an ETA when this issue will be fixed? I’m just asking because there is this other issue (Redirect whole site to subfolder (except static assets like CSS/JS)) we’re currently working around and while I really love Netlify I’m starting to have a hard time to justify using Netlify as our hosting platform to my managers :-/

Hey Flo and sorry to be slow to answer!

I took another look at your site and see a potential confounding factor - are you aware you have a long-running split test?

https://app.netlify.com/sites/cranky-beaver-ff0dbe/splits

While I can see the file /en/enterprise/index.html in both deploys, and load it successfully directly (as https://www.frontify.com/en/enterprise/) and get a 404 from both branches when loading “naturally” as /enterprise, I think maybe the split testing is compounding the issue. Are you using that split test intentionally?

Hi @fool

Yes, we’re running it to determine if we can use the split testing feature for future a/b testing. Right now both branches are identical and we’re just using them to see if the tracking works properly.

OK. Since this is a bug it would be good to know if it happens with the split test off too - mind turning it off for a moment and trying the load, and then turning it back on? Won’t cause any changes in tracking except for that moment.

Hi @fool,

sorry for the late reply. I just turned the split test off and we still get the 404 error on the https://www.frontify.com/enterprise site.

I’m leaving the split test off for the moment so you guys can have a look if it helps.

Thanks for that, Flo! Still seeing the problem with the test off, so going down the path of filing a bug. I can’t guarantee any timeline for a fix, unfortunately. Since you seem to have a single page app (I see the SPA-type /* redirect), I wonder if as a workaround you might be able put in the router to bounce people over to the french page in case you see an Accept-Language: fr type HTTP request header?

Yes, that is what our feature is supposed to do, but since it isn’t working, might be good to try to implement yourself in the meantime since your layout seems somewhat amenable to it. I wouldn’t recommend that if you don’t have a single-page app where index.html serves most/every page though, - I am not sure if you do that though?

Hi @fool,

thanks for your suggestion. Since the site is running on Gatsby I just added a client-side redirect for the /enterprise url for now and even though it’s not pretty, it’s working :wink:

Can you update this issue once you guys fixed it?

@flo, yes, if/when the issue is resolved we will update this community topic to notify you about it. The issue and topic are cross-linked for tracking.