Monorepo for Tangled tangled.org

Sites serve directories without a trailing slash, breaking relative paths and links #548

Closed oppi.li
Closed opened by oppi.li
assigned to anirudh.fi

Example: https://sajidanwar.tngl.io/baseline-diagnostic-font

When serving a <path> that doesn't exist, the sites worker checks to see if <path>/index.html exists and then directly serves that. This is the case even if <path> doesn't end in a trailing slash, which is problematic with how browsers handle relative paths. In my example site above, I link to a web font CSS file at ./baseline-diagnostic-font.css, expecting to find it in the same directory as the index.html. Without the trailing slash, the browser looks it up at the root instead, breaking the font.

I looked at GitHub's behavior and they do 301 Moved Permanently redirects from "un-slashed" directories to their trailing slash versions (which then does serve index.html directly).

+1.

Behaviour similar to Cloudflare's "Automatic trailing slashes" would be great. Forcing slashes as shown on that docs page would be fine as well. I think browsers hide them anyway?

should be fixed now!

Sign up or Sign in to add to the discussion.