Page MenuHomePhabricator

REST-Gateway: Requirements for gateway response headers vs service/app layer response headers
Closed, ResolvedPublic

Description

There are response headers that overlap in all services which can be handled at the level of the gateway and also response headers specific to the application/service which can be handled at the application/service level.

The goal of this task is to come up with a requirement for the gateway as to what response headers it should handle so that the rest will be handled at the level of the service itself.

Acceptance criteria

  • Go through services inside RB to figure out which response headers can happen at the gateway level
  • The rest of the response headers should remain in the application/service layer
  • All services should (maybe only?) use the gateway level response headers and code should be updated to delete (?) what is already happening at the gateway layer
  • Test per service to ensure that response headers are still working as before.
  • Clients should not notice any change in behavior as the response headers are expected to be returned the same.
NOTE: Paste where investigation will be happening: P48286

Event Timeline

Some notes/context:

Thanks for these notes @hnowlan. Very useful and I also saw this in the doc. Once I'm done with the research, I'll comment here with all the global headers we want rest-gateway to set then we can know the next step forward.

@hnowlan, per the 2 links above, I've also double checked that the global response headers sent by RB matches what is returned by rest-gateway. That's a very good start, now I have to dig into each service to see if there are more common headers among services that are the same to make them global.

@hnowlan, everything in app.js for all services is already in rest-gateway global headers and it matches what was already in RB global headers.

We can do 1 of 2 things:

  1. Leave global headers in rest-gateway and in app.js for all services for parity. So that if a service doesn't set it, then the gateway should and if the service has set it already, then the gateway can just forward.
  1. We can remove the headers from app.js and rely only on rest-gateway to set the global headers common across services. This will mean remove code from app.js related to these global headers for all services.

But I would suggest we go with option 1 until we've finished migrating routing all traffic to go through rest-gateway and give some time for services to run before we completely rely on it for the global headers. So that in case a service needs a global header that the rest-gateway is not setting, then the service will set it and the gateway will forward it to clients.

In essence, what I mean here is, very little work is needed as rest-gateway global headers reflect RB global headers (requirements fulfilled). Maybe @pmiazga has extra thoughts here from the architecture side of things.

I think #2 is a worthy goal but not necessarily something we need to push for right now. Are there additional headers required or missing from the gateway at present?

I think #2 is a worthy goal but not necessarily something we need to push for right now. Are there additional headers required or missing from the gateway at present?

Okay Hugh, noted. Right now, I don't see any headers we are missing.

As API Gateway is nowadays owned by serviceops, adding the serviceops project tag to open API Gateway tasks tagged with the deprecated/archived "Platform Team Initiatives (API Gateway)" tag at https://phabricator.wikimedia.org/project/profile/4321/, as part of Phabricator Housekeeping.

hnowlan claimed this task.