WMDE-leszek added a comment.

There has been some discussion on https://gerrit.wikimedia.org/r/330164 about what HTTP response code should be used.

Initially code 303 has been proposed, as it is the response code used by Special:EntityData while performing content negotiation.
Use case of Special:EntityPage is slight different, though, i.e. there is not content negotiation, it is about providing a uniform way of linking to entity pages.
In the above-mentioned patch 301 has been suggested as a possible better response code choice.

HTTP 1.1 standard (https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html) defines 301 as:

301 Moved Permanently

The requested resource has been assigned a new permanent URI and any future references to this resource SHOULD use one of the returned URIs. Clients with link editing capabilities ought to automatically re-link references to the Request-URI to one or more of the new references returned by the server, where possible. This response is cacheable unless indicated otherwise.

wheres code 303 as:

303 See Other

The response to the request can be found under a different URI and SHOULD be retrieved using a GET method on that resource. This method exists primarily to allow the output of a POST-activated script to redirect the user agent to a selected resource. The new URI is not a substitute reference for the originally requested resource. The 303 response MUST NOT be cached, but the response to the second (redirected) request might be cacheable.

Special:EntityPage is clearly not the primary use case of 303 - it is not about POST-requests forwarding.
In this regard 301 as a code specifying kind of alias seems closer of the intent behind Special:EntityPage. I am not completely certain about the "permanence" imposed in 301 definition. I guess it does not do much harm if clients learn URLs Special:EntityPage redirects to and use them directly but this is no something I have initially considered at all.

@Aleksey_WMDE @daniel: I am going to change the status code to 301 in the patch as it seems to be a slightly better choice in our case. I am not entirely convinced. I believe it might be worth to document any further discussion/consideration in the ticket here for possible future reference, so it is not buried in code review comments on Gerrit.


TASK DETAIL
https://phabricator.wikimedia.org/T153499

EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: WMDE-leszek
Cc: gerritbot, Aleksey_WMDE, WMDE-leszek, Jakob_WMDE, Lydia_Pintscher, Aklapper, daniel, Th3d3v1ls, Ramalepe, Liugev6, Lewizho99, Maathavan, D3r1ck01, Izno, Wikidata-bugs, aude, Mbch331
_______________________________________________
Wikidata-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to