302 redirect with splat not working

Hi, I’m failing to understand why my redirects won’t work.

I have redirects in this format
/part1/part2/* /part1/part2/ 302
that I need so that any access to paths inside /part1/part2/ (e.g. /part1/part2/test404) gets redirected to /part1/part2/.

Unfortunately, these don’t work and I have no idea why. Just changing the 302 to 200 seems to work, but I wanted a 302 instead.

I can’t share the website name and test urls publicly but I’ll send a DM to whoever is available to help.

Thanks in advance.

Ok, interesting, did one last test where I used this format instead:
/part1/part2/* /part1/part2/index.html 302
and now it works perfectly!

Now the question remains, why do I need the index.html? It doesn’t seem to add anything…

Please DM the site name to me. I’ll check further.

Hi, @fvieira. Hrishikesh shared the information with me and I do agree that the 302 status redirect rules without the index.html do not work while the one with it do. I also agree that adding the index.html to the rule should not be required.

We made some recent changes to how redirects are processed that may resolve this. Would you be willing to please try the rules without the index.html again as they may work now with the changes made.

However, if they still don’t work, please let us know and we’ll get an issue filed for this.

Hi @luke, sorry it took so long to reply, but I finally managed to get around to test this, and unfortunately it still doesn’t work.
I’ll send you a DM with two permalinks, one where it works (with index.html) and another without.

Hey @fvieira,

We’ve asked the devs about this issue. We’ll let you know once we have more info.

Hi @fvieira,

Based on the investigation, this is discovered to be intended behaviour. To prevent a redirect loop, you either need to add /index.html in the end, OR change the 301 (or 302) to a 200.

Hi @hrishikesh, thanks for your answer but I’m not sure I understand it.

From your explanation it seems like this would result in a redirect loop:
/part1/part2/* /part1/part2/ 302

while this wouldn’t:
/part1/part2/* /part1/part2/index.html 302

but why?
To me it seems like /part1/part2/index.html fits the pattern /part1/part2/* even better than /part1/part2/ does and so would be more likely to result in a redirect loop, so how come that one prevents it?

That’s an internal mechanism to prevent the loop in that specific condition. Both those redirects are treated differently based on the server’s code.

Ok, in that case it seems like it would be more useful to have an exception to allow for the /part1/part2/* /part1/part2/ 302 syntax, but maybe there’s a good reason not too, I’ll drop the case.
Thanks for the help!