By mbirkan
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?
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!
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!
Best,
Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.