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
Comment on Self host Blorp, your personal Lemmy/PieFed frontend
moseschrute@lemmy.world 8 months ago
I was today years old when I learned Lemmy doesn’t let you have links without a trailing slash
moseschrute@piefed.social 8 months ago
cecilkorik@lemmy.ca 8 months 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 8 months ago
And posting from piefed, is the result the same?
https://piefed.ca/ -- has a trailing slash
https://piefed.ca -- does notcecilkorik@lemmy.ca 8 months 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).
Zwiebel@feddit.org 8 months ago
Aren’t trailing slashes completely useless?
MysteriousSophon21@lemmy.world 8 months 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 8 months 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 8 months ago
Unpkg.com shows different results based on trailing /