Skip to content

Duplicated site content if navigating to */index.html documents directly #9552

Closed as not planned
@hofalk

Description

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

Navigation to index.html of any page on a clean docusaurus 3.0 installation behind webserver/loadbalancer renders the page twice (e.g. site.xy/index.html or site.xy/blog/index.html). Navigation to the folder url works as expected (e.g. site.xy or site.xy/blog)

I've experienced this issue behind an AWS NLB and was able to reproduce it with a clean docusaurus 3 installation on a local nginx webserver as well (see reproduce case below). We only experienced it after upgrading to 3.0 so I am assuming it's a 3.0 only issue.

The reproduce case is utilizing docker & docker-compose for this, but it should also work on any locally installed & configured webserver. The issue does NOT occur however on running a development server, neither does it occur wen using npm run build && npm run serve

Reproducible demo

No response

Steps to reproduce

  1. create fresh docusaurus installation through: npx create-docusaurus@latest docusaurus-test classic --typescript and change to installation dir docusaurus-test
  2. run npm run build
  3. create a basic ./default.conf for nginx:
server {
    listen       80;
    listen  [::]:80;
    server_name  localhost;

    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
    }
}
  1. create a basic ./docker-compose.yaml service mounting the config and build:
version: '3'
services:
  docs:
    image: nginx:latest
    container_name: docs
    ports:
      - "8080:80"
    volumes:
      - ./default.conf:/etc/nginx/conf.d/default.conf
      - ./build:/usr/share/nginx/html
  1. run docker-compose up
  2. navigate to localhost:8080/index.html or localhost:8080/blog/index.html
  3. scroll down to see that the whole page is rendered twice

Expected behavior

The page should only be rendered once

Actual behavior

Every page accessed directly through */index.html is rendered twice.
Browser console does not show any errors.
image

Your environment

  • Docusaurus version used: 3.0.0 with react 18.2.0
  • Environment name and version: Chrome 119.0.6045.124, Node.js 18.13
  • Operating system and version: Ubuntu 20.04.6 LTS

Self-service

  • I'd be willing to fix this bug myself.

Metadata

Assignees

No one assigned

    Labels

    bugAn error in the Docusaurus core causing instability or issues with its execution

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions