Question

Static web site on App Platform - trailing slash automatic redirect

I’m having an issue with relative links when deploying a static website to App Platform.

For example, the https://mvilla.it/fenix/index.html file is available both via https://mvilla.it/fenix and https://mvilla.it/fenix/

The URL without the trailing slash breaks all relative links in the page. Is there a option to always append trailing slashes?

Thanks

Show comments

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi there @matteoSnorkler,

Indeed this seems to be the case, thank you for reporting this. I think that this might not be doable as of the time being. I’ve forwarded this information to the App Platform engineering team.

Regards, Bobby

As another person having the same issue, I would also like to say that, for static websites, allowing the non-existence of a trailing slash is almost unnecessary.

Given that using a static website means the team is unlikely a giant org, they are unlikely at the level to care about the customer’s preference of not having a trailing slash, but more at the level of preventing the website from breaking down. And by not having a trailing slash, the website potentially breaks down, since it affects access to resources through relative paths.

Especially in my case, deploying an webassembly-based webapp as a static website, I have no option but to support relative path, since this decision is forced by emscripten–a webassembly compiler for c++ code that I use.

In conclusion, I think adding this option, and maybe even turning this on for new websites, is likely to benefit people deploying static websites through the app platform.