Commit 635d4811 authored by Changzheng Liu's avatar Changzheng Liu Committed by Bob Van Landuyt

Add missing input box for search rate limiting configuration

Changelog: fixed
parent 0eb54428
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
%fieldset %fieldset
.form-group .form-group
= f.label :search_rate_limit, _('Maximum authenticated requests by a user per minute'), class: 'label-bold' = f.label :search_rate_limit, _('Maximum number of requests per minute for an authenticated user'), class: 'label-bold'
.form-text.gl-text-gray-600 .form-text.gl-text-gray-600
= _("Set this number to 0 to disable the limit.") = _("Set this number to 0 to disable the limit.")
= f.number_field :search_rate_limit, class: 'form-control gl-form-input'
= f.label :search_rate_limit, _('Maximum number of requests per minute for an authenticated user'), class: 'label-bold'
.form-group .form-group
= f.label :search_rate_limit_unauthenticated, _('Maximum number of requests per minute for an unauthenticated IP address'), class: 'label-bold' = f.label :search_rate_limit_unauthenticated, _('Maximum number of requests per minute for an unauthenticated IP address'), class: 'label-bold'
= f.number_field :search_rate_limit_unauthenticated, class: 'form-control gl-form-input' = f.number_field :search_rate_limit_unauthenticated, class: 'form-control gl-form-input'
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
.settings-content .settings-content
= render partial: 'network_rate_limits', locals: { anchor: 'js-files-limits-settings', setting_fragment: 'files_api' } = render partial: 'network_rate_limits', locals: { anchor: 'js-files-limits-settings', setting_fragment: 'files_api' }
%section.settings.as-note-limits.no-animate#js-search-limits-settings{ class: ('expanded' if expanded_by_default?) } %section.settings.as-search-limits.no-animate#js-search-limits-settings{ class: ('expanded' if expanded_by_default?) }
.settings-header .settings-header
%h4 %h4
= _('Search rate limits') = _('Search rate limits')
......
...@@ -153,6 +153,17 @@ Set the limit to `0` to disable it. ...@@ -153,6 +153,17 @@ Set the limit to `0` to disable it.
- **Default rate limit**: Disabled (unlimited). - **Default rate limit**: Disabled (unlimited).
### Search rate limit
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/80631) in GitLab 14.9
This setting limits global search requests.
| Limit | Default (requests per minute) |
|-------------------------|-------------------------------|
| Authenticated user | 30 |
| Unauthenticated user | 10 |
## Gitaly concurrency limit ## Gitaly concurrency limit
Clone traffic can put a large strain on your Gitaly service. To prevent such workloads from overwhelming your Gitaly server, you can set concurrency limits in Gitaly's configuration file. Clone traffic can put a large strain on your Gitaly service. To prevent such workloads from overwhelming your Gitaly server, you can set concurrency limits in Gitaly's configuration file.
......
...@@ -130,6 +130,7 @@ The **Network** settings contain: ...@@ -130,6 +130,7 @@ The **Network** settings contain:
Git LFS requests that supersede the user and IP rate limits. Git LFS requests that supersede the user and IP rate limits.
- [Files API Rate Limits](files_api_rate_limits.md) - Configure specific limits for - [Files API Rate Limits](files_api_rate_limits.md) - Configure specific limits for
Files API requests that supersede the user and IP rate limits. Files API requests that supersede the user and IP rate limits.
- [Search rate limits](../../../administration/instance_limits.md#search-rate-limit) - Configure global search request rate limits for authenticated and unauthenticated users.
- [Deprecated API Rate Limits](deprecated_api_rate_limits.md) - Configure specific limits - [Deprecated API Rate Limits](deprecated_api_rate_limits.md) - Configure specific limits
for deprecated API requests that supersede the user and IP rate limits. for deprecated API requests that supersede the user and IP rate limits.
- [Outbound requests](../../../security/webhooks.md) - Allow requests to the local network from hooks and services. - [Outbound requests](../../../security/webhooks.md) - Allow requests to the local network from hooks and services.
......
...@@ -22828,9 +22828,6 @@ msgstr "" ...@@ -22828,9 +22828,6 @@ msgstr ""
msgid "Maximum authenticated API requests per rate limit period per user" msgid "Maximum authenticated API requests per rate limit period per user"
msgstr "" msgstr ""
msgid "Maximum authenticated requests by a user per minute"
msgstr ""
msgid "Maximum authenticated web requests per rate limit period per user" msgid "Maximum authenticated web requests per rate limit period per user"
msgstr "" msgstr ""
......
...@@ -707,6 +707,20 @@ RSpec.describe 'Admin updates settings' do ...@@ -707,6 +707,20 @@ RSpec.describe 'Admin updates settings' do
include_examples 'regular throttle rate limit settings' include_examples 'regular throttle rate limit settings'
end end
it 'changes search rate limits' do
visit network_admin_application_settings_path
page.within('.as-search-limits') do
fill_in 'Maximum number of requests per minute for an authenticated user', with: 98
fill_in 'Maximum number of requests per minute for an unauthenticated IP address', with: 76
click_button 'Save changes'
end
expect(page).to have_content "Application settings saved successfully"
expect(current_settings.search_rate_limit).to eq(98)
expect(current_settings.search_rate_limit_unauthenticated).to eq(76)
end
end end
context 'Preferences page' do context 'Preferences page' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment