Aren’t trailing slashes completely useless?
Comment on Self host Blorp, your personal Lemmy/PieFed frontend
moseschrute@lemmy.world 3 weeks ago
I was today years old when I learned Lemmy doesn’t let you have links without a trailing slash
Zwiebel@feddit.org 3 weeks ago
shnizmuffin@lemmy.inbutts.lol 3 weeks 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 3 weeks ago
MysteriousSophon21@lemmy.world 3 weeks 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.
moseschrute@piefed.social 3 weeks 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 3 weeks 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 3 weeks 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 3 weeks 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).