docusaurus start and docusaurus build && docusaurus serve have different routing rule about static folder
See original GitHub issue🐛 Bug Report
Prerequisites
- I’m using the latest version of Docusaurus.
- I have tried the
npm run clearoryarn clearcommand. - I have tried
rm -rf node_modules yarn.lock package-lock.jsonand re-installing packages. - I have tried creating a repro with https://new.docusaurus.io
- I have read the console error message carefully (if applicable)
Description
If you use docusaurus start static folder routings are
- no accessable if file dir has “.” string and file destination url can omit /index path
- accessable even if dir name has “.” string and the filename is not index.html (can’t omit part of url derive from filename)
If you use docusaurus build and serve static folder routings are
- no accessable if file name has “.” string
- accessable even if dir name has “.” string
As I thought it, Docusaurus shouldn’t rewrite url about static folder resources because its files are tended to be linked by idempotent routing rule and may not depend on hosting server rewriting rule as default.
Have you read the [Contributing Guidelines on issues]
yes
Steps to reproduce
To reproduce, we need build step so I made repository for this because I can’t find the way to do using sanbox.
Demo: https://github.com/tkow/docusaurus-url-denied-demo
- Pull code from master branch and setup project:
npm install - Run
npm run startand accesslocalhost:3000/htmlin browser - List of links appears having message of whether or not be accessible when using
docusaurus build and docusaurus serveand check mismatching between the results of navigating and showing messages by clicking links. - Run
npm run build && npm run serveand accesslocalhost:3000/htmlin browser - List of links appears having message of whether or not be accessible when using
docusaurus build and docusaurus serveand check matching between the results of navigating and showing messages by clicking links.
Expected behavior
We have same routings between docsaurus start and docsaurus build and docsaurus serve.
And static route should not be applied rewrite rules as default.
Actual behavior
We have different routings result between docsaurus start and docsaurus build and docsaurus serve.
Your environment
- Public source code: https://github.com/tkow/docusaurus-url-denied-demo
- Public site URL: None
- Docusaurus version used:
"@docusaurus/core": "2.0.0-beta.6"
"@docusaurus/preset-classic": "2.0.0-beta.6"
- Environment name and version (e.g. Chrome 78.0.3904.108, Node.js 10.17.0): Chrome version: 94.0.4606.61(Official Build) (x86_64, Node.js v12.22.1
- Operating system and version (e.g. Ubuntu 20.04.2 LTS): macOS Big Sur version 11.5.2(20G95)
Reproducible demo
Issue Analytics
- State:
- Created 2 years ago
- Comments:6

Top Related StackOverflow Question
Hi @tkow
docusaurus serveis mostly a tool we provide for convenient local testing. In production you’d rather use a more advanced HTTP server for static files that you can configure according to your own needs, preferably a CDN for performance reasons.I still think that we can keep this issue open because we should try to make the dev & build/serve similar if possible, but we may close later this issue as wontfix if it’s not possible to do so
Closing as wontfix, because we neither control the routing of
startnorserve. I also believe #5420 would have fixed it already.