Aren’t trailing slashes completely useless?
Comment on Self host Blorp, your personal Lemmy/PieFed frontend
moseschrute@lemmy.world 1 day ago
I was today years old when I learned Lemmy doesn’t let you have links without a trailing slash
Zwiebel@feddit.org 23 hours ago
MysteriousSophon21@lemmy.world 1 hour ago
Trailing slashes actually serve an important purpose in URLs - they indicate you’re requesting a directory rather than a file, which affects how servers route reqeusts and can impact caching, redirects, and SEO.
shnizmuffin@lemmy.inbutts.lol 21 hours ago
No, not at all.
They are a shorthand for “give me the index of this directory” rather than “give me the first file you find named this.” In some configurations, the presence of absence of a trailing slash dramatically reduces the amount of computation an HTTP server must execute before responding to the request.
moseschrute@lemmy.world 19 hours ago
moseschrute@piefed.social 1 day ago
It get's even weirder. I'm now writing this from PieFed. If you view this comment from PieFed it won't have the trailing slash, but from Lemmy it will.
https://piefed.social
cecilkorik@lemmy.ca 1 day ago
Very interesting I wonder what happens if I post both trailing and non-trailing options, do they both get canonized into the same format?
piefed.ca – has a trailing slash piefed.ca – does not
Thank you for having me along on this journey. I don’t really know where it’s leading, but maybe it’s about the weird software behaviors we discover on the way.
cecilkorik@piefed.ca 1 day ago
And posting from piefed, is the result the same?
https://piefed.ca/ -- has a trailing slash
https://piefed.ca -- does not
cecilkorik@lemmy.ca 1 day ago
Yup, they all have trailing slashes when viewed on Lemmy, and 3/4 have trailing slashes when viewed on piefed. So only piefed actually respects what was originally typed. Lemmy adds a trailing slash when you’re adding the comment, and also adds a trailing slash when reading a comment posted that doesn’t originally have a trailing slash. Intriguing (and slightly annoying).