benwk
benwk
CDCloudflare Developers
Created by benwk on 9/4/2023 in #pages-help
How to setup Redirects for SPA with multiple directories?
4 replies
CDCloudflare Developers
Created by benwk on 9/4/2023 in #pages-help
How to setup Redirects for SPA with multiple directories?
Yeah...got it. That makes sense for new projects, but Angular builds a lot of things in the root as default and this project has been around for several years. It puts a lot of stuff, like ngsw-worker.js right in the root as well. Tried tweaking it, but it's a pain with all the legacy code. 😩
4 replies
CDCloudflare Developers
Created by benwk on 9/4/2023 in #pages-help
How to setup Redirects for SPA with multiple directories?
Thank you for the clarification regarding the redirect rule. Applying /en-us/* /en-us/ 200 did solve the original routing issue; however, it has introduced a new problem. Now, the browser console reports an error: Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec. It appears that all .js and .css files are also being redirected to /en-us/index.html, which is causing the MIME type mismatch. This has rendered even previously working URLs non-functional. Any ideas on how to resolve this while maintaining the intended routing behavior?
4 replies