GraphQL API rate limit responses do not include rate limit headers

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

GitLab.com has documented rate limit headers here. These headers do not appear on a rate limit response from the GraphQL API.

Steps to reproduce

Make a bunch of requests to GitLab's GraphQL API. Get rate limited.

Example Project

What is the current bug behavior?

The response from GitLab does not include headers described in this document.

The response looks like this, missing those rate limit headers:

{
    status: 429,
    statusText: 'Too Many Requests',
    headers: {
      date: 'Tue, 08 Feb 2022 22:13:18 GMT',
      'content-type': 'text/html',
      'transfer-encoding': 'chunked',
      connection: 'close',
      'cache-control': 'no-cache',
      'gitlab-lb': 'fe-09-lb-gprd',
      'gitlab-sv': 'localhost',
      'cf-cache-status': 'DYNAMIC',
      'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
      'report-to': '{"endpoints":[{"url":"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=Nx3%2BsiA9s%2BkJHagxdLaPywJ7Bw%2FLdNlr7CV%2Box2sh0NXSeB0ThexTPyyszH9Lqboso3me%2FVE2LjueQ4OtPD8ReSwfGzSxFfSxsgVzredLfgt4YdGPOL9KpGIa6M%3D"}],"group":"cf-nel","max_age":604800}',
      nel: '{"success_fraction":0.01,"report_to":"cf-nel","max_age":604800}',
      'strict-transport-security': 'max-age=31536000',
      'x-content-type-options': 'nosniff',
      server: 'cloudflare',
      'cf-ray': '6da8344818bb5a70-IAD'
    },
}

What is the expected correct behavior?

I expect that the response would contain headers described in this document

Relevant logs and/or screenshots

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

Edited by 🤖 GitLab Bot 🤖