Intermittent 404 with navigation links and images in Azure Static Web Apps #7695
-
I have a really strange and intermittent problem and I'd appreciate any guidance as to where to start, please. Sometimes I see it in the browser. Sometimes I don't. I use Moz Pro and it picks up the links as 404s. BackgroundI host my docs on Azure Static Web Apps (SWA) here: SWA gives you a domain OOTB, so you can also access that via: https://yellow-ocean-019829903.azurestaticapps.net I have set up a custom domain as per the documentation here using a CNAME in my UK domain host with the default TTL: ProblemMy custom domain nav URLs are missing a section. Instead of: https://docs.shineforms.co.uk/pirform/getting-started The site renders it without the pirform section: https://docs.shineforms.co.uk/getting-started When this happens, images also don't render. When this happens, the default SWA domain renders correctly: It always works perfectly when running locally! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
Hello @seankearon, MkDocs by default enables the directory url setting and based on that it generates those relative paths: The issue you're facing is that your URL on the screenshot doesn't have the final All of the generated paths should be correct with the I'm not an Azure expert, but you need to reconfigure it to redirect paths not ending with TLDR |
Beta Was this translation helpful? Give feedback.
Hello @seankearon,
MkDocs navigation works based on relative paths, and generates static HTML files, so the relative paths in the loaded file remain always the same no matter how it's loaded.
MkDocs by default enables the directory url setting and based on that it generates those relative paths:
The issue you're facing is that your URL on the screenshot doesn't have the final
/
.Your server is configured to load the correct HTML file despite the path being wrong, but the relative paths inside the source now resolve to different things.
All of the generated paths should be correct with the
/
at the end, so the paths with…