Skip to content

Add RateLimit-* headers to RackAttack responses

Something I noticed when I was looking at https://docs.gitlab.com/ee/user/gitlab_com/index.html#haproxy-api-throttle is that we document these RateLimit-* headers we set.

We don't get these for free with Rack Attack, but we could add them: https://github.com/rack/rack-attack#ratelimit-headers-for-well-behaved-clients We already manually add them in HAProxy: https://gitlab.com/gitlab-cookbooks/gitlab-haproxy/-/blob/3a8f7adbc0e0ce5996e529e6dd45b135caf13f2c/templates/default/haproxy-frontend.cfg.erb#L320-324

I think we should, because clients like https://github.com/xanzy/go-gitlab/blob/master/gitlab.go#L47-48 expect these.

So that is:

cc @jacobvosmaer-gitlab @cmiskell

Edited by Quang-Minh Nguyen