Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page is not found if the page folder name begins with capital letter #8017

Closed
5 of 7 tasks
m19v opened this issue Aug 28, 2022 · 1 comment
Closed
5 of 7 tasks

Page is not found if the page folder name begins with capital letter #8017

m19v opened this issue Aug 28, 2022 · 1 comment
Labels
closed: question This issue is a user error/misunderstanding. external This issue is caused by an external dependency and not Docusaurus.

Comments

@m19v
Copy link

m19v commented Aug 28, 2022

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and 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

The page is not found and 404 returned to get request when the page folder name starts with capital letter. E.g. /src/pages/Support/ but not as it supposed to be according the documentation /src/pages/support/.

**Note! ** I could not reproduce the error locally and only noticed after e.g. deploying to github pages.

Reproducible demo

No response

Steps to reproduce

  1. Create new page: create a new page and name the folder of page with capital letter src/pages/Support/index.js.
  2. Build and deploy to e.g. github pages
  3. Go to support page
  4. Reload the browser with e.g. F5

Expected behavior

Page with its css properties loads

Actual behavior

One notice a short of time 'Page not found' page but then support page loads but with a wrong css properties. In Browser devtool the get request for url /support gets 404

Your environment

  • Public source code:
  • Public site URL:
  • Docusaurus version used:
  • Environment name and version (e.g. Chrome 89, Node.js 16.4):
  • Operating system and version (e.g. Ubuntu 20.04.2 LTS):

Self-service

  • I'd be willing to fix this bug myself.
@m19v m19v added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Aug 28, 2022
@Josh-Cena
Copy link
Collaborator

Josh-Cena commented Aug 28, 2022

Hi! URL resolution is defined by your host. When you enter https://example.com/src/pages/support/ into the address bar, you send a GET request to that URL. The host then responds with the data — an HTML page in this case. However, apparently GitHub pages matches the URL case-sensitively, so it returns a 404 page, because it believes that page doesn't exist. Still, the right page is eventually displayed, because our router (which is client-side) is case-insensitive, so it hydrates the page with the right React vdom. Unfortunately, it does so on the 404 HTML, instead of the HTML containing the real DOM, so there's a hydration mismatch, which leads to the wrong CSS styles (I believe it's because the class names are applied to the wrong elements).

There's nothing Docusaurus can do here. GitHub pages is not configurable so you can't let it serve pages case-insensitively. You just need to make sure the links are always written with the correct casing. You would encounter the exact same pitfall with trailing slashes.

@Josh-Cena Josh-Cena closed this as not planned Won't fix, can't repro, duplicate, stale Aug 28, 2022
@Josh-Cena Josh-Cena added external This issue is caused by an external dependency and not Docusaurus. closed: question This issue is a user error/misunderstanding. and removed bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Aug 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed: question This issue is a user error/misunderstanding. external This issue is caused by an external dependency and not Docusaurus.
Projects
None yet
Development

No branches or pull requests

2 participants