Page MenuHomePhabricator

Toolforge.org: k8s canonical temporal redirect uses HTTP 301
Closed, ResolvedPublic

Description

Some tests by @LucasWerkmeister using webservice 0.66 and the --canonical switch indicated that nginx-ingress is returning HTTP 301.

This has some consequences:

  • the tool developer cannot easily revert the redirect once it has been introduced. We should use HTTP 307 instead, so the --canonical switch can be reverted.
  • firefox translated POST request to GET. Not sure if this is related to the HTTP 301 or that we need some special case for requests other than GETs

Event Timeline

Change 587807 had a related patch set uploaded (by Arturo Borrero Gonzalez; owner: Arturo Borrero Gonzalez):
[operations/software/tools-webservice@master] kubernetes: ingress: use HTTP 307 for canonical redirect

https://gerrit.wikimedia.org/r/587807

Change 587807 merged by jenkins-bot:
[operations/software/tools-webservice@master] kubernetes: ingress: use HTTP 307 for canonical redirect

https://gerrit.wikimedia.org/r/587807

Patch is merged, we need another release of the tools-webservice package before we announce the toolforge.org domain next monday.

firefox translated POST request to GET. Not sure if this is related to the HTTP 301 or that we need some special case for requests other than GETs

If I read this correctly, the right status code for “permanent redirect, don’t change the method” would be 308, so I guess that one should be used by the permanent/legacy redirector once that’s in place. (Though POSTs to the old URLs should probably be rare.)

Change 588013 had a related patch set uploaded (by Bstorm; owner: Bstorm):
[operations/software/tools-webservice@master] d/changelog: prepare for 0.67 release

https://gerrit.wikimedia.org/r/588013

Change 588013 merged by jenkins-bot:
[operations/software/tools-webservice@master] d/changelog: prepare for 0.67 release

https://gerrit.wikimedia.org/r/588013

Mentioned in SAL (#wikimedia-cloud) [2020-04-10T19:32:33Z] <bstorm_> deployed webservice 0.67 T249843

Mentioned in SAL (#wikimedia-cloud) [2020-04-10T19:36:56Z] <bstorm_> after testing deploying toollabs-webservice 0.67 to tools repos T249843

Ok, the bastions now all have the new version of webservice.

Mentioned in SAL (#wikimedia-cloud) [2020-04-10T21:33:48Z] <bd808> Rebuilding all Docker images for the Kubernetes cluster (T249843)

firefox translated POST request to GET. Not sure if this is related to the HTTP 301 or that we need some special case for requests other than GETs

We should use the 307 & 308 response codes instead of 301 & 302. 307 and 308 were added in the HTTP/1.1 spec to help resolve the ambiguity of what to do when a POST is redirected [ 0 ]. Other that that the only real possibility is forcing each tool that uses POST to operate properly at both URLs. We had this same "POST loophole" issue in WMF production when we forced TLS for all requests and http://tools.wmflabs.org has it still.

Change 588380 had a related patch set uploaded (by Arturo Borrero Gonzalez; owner: Arturo Borrero Gonzalez):
[operations/puppet@production] toolforge: legacy URLs: use HTTP 307/308 for the redirects

https://gerrit.wikimedia.org/r/588380

Change 588380 merged by Arturo Borrero Gonzalez:
[operations/puppet@production] toolforge: legacy URLs: use HTTP 307/308 for the redirects

https://gerrit.wikimedia.org/r/588380