Skip to content

bluwy/trailing-slash-servers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

trailing-slash-servers

See how different servers handle serving HTML files and trailing slashes.

The format follows https://github.com/slorber/trailing-slash-guide.

Check out my blog to learn more about trailing slashes! https://bjornlu.com/blog/trailing-slash-for-frameworks

website
├── file.html
│
├── folder
│   └── index.html
│
├── both.html
└── both
    └── index.html

Result

Server Settings Url /file /file/ /file.html /folder /folder/ /folder/index.html /both /both/ /both.html /both/index.html
express link 💢 404 💢 404 ➡️ /folder/ ➡️ /both/
express with HTML extensions link 💢 404 ➡️ /folder/ ➡️ /both/
sirv link
http-server link 💢 404 ➡️ /folder/
deno (file-server) link 💢 404 💢 404 ➡️ /folder/
python -m http.server link 💢 404 💢 404 ➡️ /folder/ ➡️ /both/
httpd (apache) link 💢 404 💢 404 ➡️ /folder/ ➡️ /both/
nginx link 💢 404 💢 404 ➡️ /folder/ ➡️ /both/

Environments:

  • Node: 18.20.3
  • Deno: 1.46.3
  • Python: 3.12.6
  • Apache: 2.4.62
  • Nginx: 1.27.1

Configuration

Here are some configurations I used for my own machine locally. Yours may be different.

httpd (apache)

/opt/homebrew/etc/httpd/httpd.conf:

ServerName http://localhost:8080

nginx

/opt/homebrew/etc/nginx/nginx.conf:

http {
  server {
    listen       8081;
    server_name  localhost;

    location / {
      root   /Users/bjorn/Work/oss/trailing-slash-servers/website;
    }
  }
}

License

MIT

About

See how different servers handle serving HTML files and trailing slashes

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Contributors 3

  •  
  •  
  •