极狐GitLab 是 GitLab 在中国的发行版,关于中文参考文档和资料有:
- 极狐GitLab 中文文档
- 极狐GitLab 中文论坛
- 极狐GitLab 官网
项目 API 的速率限制 (BASIC SELF)
-
引入于 15.10 版本,功能标志为rate_limit_for_unauthenticated_projects_api_access,默认禁用。
-
在私有化部署版上默认启用于 16.0 版本。
-
在极狐GitLab Generally available in GitLab 16.0. Feature flag rate_limit_for_unauthenticated_projects_api_access removed.
-
Rate limit for group and projects API introduced in GitLab 17.1. with a flag named rate_limit_groups_and_projects_api. Disabled by default.
-
引入于 15.10 版本,功能标志为 rate_limit_for_unauthenticated_projects_api_access,默认禁用。
-
极狐GitLab 16.0 中为私有化部署版本默认开启。
-
极狐GitLab 16.0 GA 并已移除功能开关 rate_limit_for_unauthenticated_projects_api_access。
-
针对群组和项目 API 的速率限制自极狐GitLab 17.1 引入,并使用名为 rate_limit_groups_and_projects_api 的功能开关。默认禁用。
您可以为下列[项目 API] 的每一个 IP 地址和用户配置速率限制。
限制 | 默认值 | 查询间隔 |
---|---|---|
GET /projects (unauthenticated requests) | 400 | 10 分钟 |
GET /projects (authenticated requests) | 2000 | 10 分钟 |
GET /projects/:id | 400 | 1 分钟 |
GET /users/:user_id/projects | 300 | 1 分钟 |
GET /users/:user_id/contributed_projects | 100 | 1 分钟 |
GET /users/:user_id/starred_projects | 100 | 1 分钟 |
更改速率限制:
1.在左侧导航栏底部,选择 管理中心。
2.选择 设置 > 网络。
3.展开 项目 API 速率限制。
4.在 每个 IP 地址每 10 分钟的最大请求数 文本框中,输入新值。
5.选择 保存更改。
速率限制:
- 适用于每个 IP 地址。
- 不适用于经过身份验证的请求。
- 可以设置为 0 来禁用速率限制。
- 除了对 GET /projects API 的未认证请求外,rate_limit_groups_and_projects_api 背后还有其他限制。
超过速率限制的请求将记录到 auth.log 文件中。
例如,您将限制设置为 400,则会阻止在 10 分钟内超过 400 速率的对 GET /projects/:id API 端点的未经身份验证的请求。十分钟后恢复对端点的访问。