Jump to content

User:Giuseppe Lavagetto/Production Playbook

From Wikitech

Template:Toc

How to perform HTTP requests

When your service needs to perform HTTP requests to fetch external entities, you can't just fetch the response from the url you want to point to.

There are a few things to keep in mind when making requests, the details of which will depend on whether you are making a request to another wikimedia property (so: basically any call to a service or to *.wikipedia.org and the other wikis), or not.

Requests to Wikimedia properties

  • Your code needs to be able to request a property from a specific hostname/ip:port combination, and specify the value of the Host: header separately
  • Don't do retries, exponential backoffs, circuit breaking or any similar feature. Those will be handled and implemented by our service mesh
  • Your code should always be able to handle 504 errors (timeouts in the service mesh, typically)
  • Don't cache any data you get from a remote http call unless you also have a plan for cache invalidation (see below)