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

did:plc:55mvy6od2watiacwej7srdkn opened this 5d ago 1 comments
did:plc:55mvy6od2watiacwej7srdkn opened 5d ago

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).

No activity yet.

cospan · schematic version control on atproto built on AT Protocol