-
Notifications
You must be signed in to change notification settings - Fork 44
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
Where to make write requests for resources that return 303 for retrieval? #344
Comments
There is a related requirement in the Solid Protocol: write requests on representation URLs when different from the resource URL are to 307/308 to the original resource. When there is a write request on the final URL (after 303,.. the eventual 200), we can't ask the client to re-issue the request against the original resource since that would get stuck in 303->307/308->303. Requests to the original resource returning different responses depending on request's method - 303 for GET/HEAD, and either 200 or 307/308 for PUT/POST/PATCH - doesn't seem right to me either. Should we expect/suggest the client to make their write requests to /bar? |
@csarven TrinPod uses a 303 redirect from webid in the form: https://user.trinpod.us/i to https://user.trinpod.us/profile/card . OPTIONS, HEAD and GET do the 303 redirect, but there is no redirect with POST PATCH PUT DELETE |
The architecture of the web is that you read write documents, not people. Typically we use the It seems to me the logical thing to do with the 303, when there is a 303 redirect from the Person to their profile, to prevent the write to the Person URI, as the agent should write the information about the person to the profile document. You certainly should not overwrite the profile document. |
Some context worth considering here:
Given these two points, from the client-side, all redirects are the same: there is simply no way to handle them differently. If Currently we have |
@ThisIsMissEm Yes, you can get full header information from the fetch() API on the browser side by looking at the headers. If you set a variable and await the fetch, such as: you can then access the headers via: response.headers.get('nameOfHeader') and for status simply response.status which is 303 on a redirect so to check for eTag value, you would use response.headers.get('eTag') and to know if the url has been redirected compare: |
@timbl If we take the definition of a resource as currently defined, then a resource can be many things. In our case, we have a card resource that contains ( http://semanticscience.org/resource/SIO_000202 a more generic contains than ldp:contains) the webid resource such that when a request is made on card, it also delivers the webid resource. The webid resource is also a resource and can be separately accessed via POST PATCH PUT DELETE, but it always redirects to card on GET, HEAD and OPTIONS per Solid spec. Then we have even a finer grained resource which is a single triple with its own uri, such that we can separately attach acl permissions to different triples on the webid. The idea being that the webid is source of all information about a given person (if its a personal webid), and that a person has an enourmous amount of information about themselves to which they would like to be the subject of a triple. I'm not sure how this is not consistent with the resource architecture of the web? |
@gibsonf1 unfortunately not, for 3xx responses, the fetch API automatically follows redirects, only allowing access to the final destination's information, and in manual mode, prohibits accessing the redirect's headers or status code; so you can't detect the difference between a 303 redirect and a 308 redirect.
For redirects the information about the status, headers, and body is removed from the result returned from fetch. I've There's also an issue on the fetch API spec to add a feature to allow access, but it's not moved in several years: whatwg/fetch#601 |
@ThisIsMissEm I see you are right on the status issue, although knowing what url you end up at is easy with response.url. So for the Solid case, maybe the simple solution since fetch is not quite up to it yet is to just add a header indicating the redirect. |
Right so, you can know that you've been redirected, via |
@ThisIsMissEm Yes, I think the answer to this is to include a header for redirect in the spec. |
e.g. /foo 303's to /bar - some WebIDs do this.
Where should client perform write operations? /foo or /bar?
Should there be a link relation in the header of /bar to /foo (or somewhere else)?
Is this well-documented somewhere e.g. in the depths of https://www.w3.org/wiki/Foaf%2Bssl ?
Examples from the wild would be good to know..
The text was updated successfully, but these errors were encountered: