ERR_TOO_MANY_REDIRECTS error after configuring HTTP Routes Redirect

I have a static website running on apps as starter plan. My web site has a directory like ‘abc’, including 2 files (one of them is index.html). When I request like mydomain/abc, there is no problem. The index.html within the abc folder works as it’s expected. However, when I click other pages on the site after requesting mydomain/abc, the application works as in the root directory unlike in the abc folder. So, I cannot request the other page in the abc folder. I get 404 error because the application works as in the root folder and expects it in the root folder.

To solve the problem, I configured an HTTP Routes Redirect definition like routepath: /abc, redirecturi: /abc/index.html in app settings. This time, I started to get ERR_TOO_MANY_REDIRECTS error when I requested like mydomain/abc. Actually, I don’t understand what the exact problem is. Any advice?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi there,

Based on your description, it sounds like when you access mydomain/abc, it redirects to mydomain/abc/index.html. Then, it’s possible the App Platform’s routing rules interpret /abc/index.html as needing to be redirected back to /abc, causing the loop. Consider removing this redirect rule entirely, as the App Platform will most likely automatically serve index.html when accessing a directory.

Also, if you’re using an SPA setup or something similar, you may need to set up fallback behavior. For SPAs, if the route doesn’t match any known routes, it should fall back to index.html (or the equivalent). What you could try doing is to setup a Catchall page in your App settings as described here:

Let me know how it goes after those changes!



Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

card icon
Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Sign up
card icon
Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We’d like to help.

Learn more
card icon
Become a contributor

You get paid; we donate to tech nonprofits.

Learn more
Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow – whether you’re running one virtual machine or ten thousand.

Learn more ->
DigitalOcean Cloud Control Panel
Get started for free

Enter your email to get $200 in credit for your first 60 days with DigitalOcean.

New accounts only. By submitting your email you agree to our Privacy Policy.

© 2023 DigitalOcean, LLC.