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 render error #3832

Closed
4 tasks done
pclokcer opened this issue Apr 26, 2024 · 4 comments · Fixed by #3837
Closed
4 tasks done

page render error #3832

pclokcer opened this issue Apr 26, 2024 · 4 comments · Fixed by #3837
Labels
bug: pending triage Maybe a bug, waiting for confirmation

Comments

@pclokcer
Copy link

Describe the bug

if I use "/" character end of url, sidebar and middle page not working normally.

Reproduction

check this error
https://stackblitz.com/edit/vite-9jamew

if you see error, add to <stackblitz test url>/en/test/ and enter. 404 page coming.
but <stackblitz test url>/en/test like this working.

Expected behavior

need to work normally. 404 page is wrong.

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (12) x64 Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz
    Memory: 2.38 GB / 15.87 GB
  Binaries:
    Node: 18.18.2 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.22 - C:\Program Files\nodejs\yarn.CMD
    npm: 9.8.1 - C:\Program Files\nodejs\npm.CMD
    pnpm: 8.6.1 - ~\AppData\Roaming\npm\pnpm.CMD
  Browsers:
    Edge: Chromium (122.0.2365.59)
    Internet Explorer: 11.0.22621.1
  npmPackages:
    vitepress: ^1.1.3 => 1.1.3

Additional context

nginx conf like

server {
    gzip on;
    gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

    listen 80;
    server_name _;
    index index.html;

    location / {
        # content location
        root /app;

        # exact matches -> reverse clean urls -> folders -> not found
        try_files $uri $uri.html $uri/ =404;

        # non existent pages
        error_page 404 /404.html;

        # a folder without index.html raises 403 in this setup
        error_page 403 /404.html;

        # adjust caching headers
        # files in the assets folder have hashes filenames
        location ~* ^/assets/ {
            expires 1y;
            add_header Cache-Control "public, immutable";
        }
    }
}

Validations

@pclokcer pclokcer added the bug: pending triage Maybe a bug, waiting for confirmation label Apr 26, 2024
@brc-dd
Copy link
Member

brc-dd commented Apr 27, 2024

Won't be fixed in dev. It works fine build + serve.

@brc-dd brc-dd closed this as not planned Won't fix, can't repro, duplicate, stale Apr 27, 2024
@pclokcer
Copy link
Author

pclokcer commented Apr 28, 2024

not working
image

@brc-dd can you check like thiss ??


working
image

working like this

@brc-dd
Copy link
Member

brc-dd commented Apr 28, 2024

You're using dev mode not prod site. Dev mode is correct. In prod you need to handle this in your server.

without proper routing, /en/test/ means there should be a file /en/test/index.md and /en/test means there should be a file /en/test.md

With cleanUrls: true, it should work fine on prod as long as your backend serves correct file. The provided nginx configuration in docs might be wrong though. It was contributed by external contributors and may not handle this case. PRs are welcome to update it.

@brc-dd
Copy link
Member

brc-dd commented Apr 28, 2024

dev will match prod behavior in next release. Regarding nginx config, I'll try to update the docs, but I don't have much experience with that.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug: pending triage Maybe a bug, waiting for confirmation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants