-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On trailing slashes for URLs / subjects #137
Comments
Not accurate. What gets added is initial slash, and the reason is that a http URI is defined as having a non-empty path segment and an URI with path omitted semantically means the same as an URI with default path "/", and the canonical form of an URI is to expand to include that implied default "/" when omitted. See RFC 2616 §3.2.2:
|
I recommend to only normalize URIs as per the rules that preserves semantics listed here: https://en.wikipedia.org/wiki/URI_normalization#Normalizations_that_preserve_semantics If in some situations multiple URIs are used for same resource, then it might be useful to advertise which of them is considered canonical - e,g, using the semantic tag designated for that: https://en.wikipedia.org/wiki/Canonical_link_element#Semantic_tag ...but please don't get too creative and mangle URIs more aggressively! |
Thanks for the clarifications @jonassmedegaard! If I'm understanding you correctly, we should infact keep the initial slash in serialization, but for trailing slashes we might consider removing them. |
Which URIs are you talking about? For freshly minted URIs, yes feel free to choose ones without trailing slashes (except the "root" URI of a site should include a slash - because a URI without any path is the SAME but non-canonical as an URI with a single slash as path). But for URIs fed by others, do not change them - beyond normalisation which does not change their semantic meaning. If you provide some API where a new object can be created and also dictated what should be the URI, either define as part of the API which URIs are acceptable and reject non-conforming requests, or define the URI part of that API only as a proposal and have the acknowledged (possibly same, but possibly mangled - also e.g. to avoid collision) URI be part of a confirmation response. See e.g. how Micropub defines such response using a Location header: https://www.w3.org/TR/micropub/#response |
Trailing slashes are weird and confusing:
http://example.com
becomeshttp://example.com/
I'm currently struggling with how to deal with trailing slashes. I've had some issues with them before, especially with home pages (where the trailing slash was added in browsers)
Atomic-Server and perhaps even the Atomic Data spec need a very clear opinion on this. For now, I think we should go with the following:
The text was updated successfully, but these errors were encountered: