From c36319994169812e0bd7a4fe3183fa2964438e3b Mon Sep 17 00:00:00 2001 From: Nejc Habjan Date: Fri, 10 Jun 2022 12:32:37 +0200 Subject: [PATCH 1/4] Add documentation for configurable _redirects limits --- doc/administration/pages/index.md | 14 ++++++++++++++ doc/user/project/pages/redirects.md | 5 +++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/doc/administration/pages/index.md b/doc/administration/pages/index.md index 7d67c648bc8c56..65cc34c0cd50c1 100644 --- a/doc/administration/pages/index.md +++ b/doc/administration/pages/index.md @@ -269,6 +269,9 @@ control over how the Pages daemon runs and serves content in your environment. | `max_uri_length` | The maximum length of URIs accepted by GitLab Pages. Set to 0 for unlimited length. [Introduced](https://gitlab.com/gitlab-org/gitlab-pages/-/issues/659) in GitLab 14.5. | `metrics_address` | The address to listen on for metrics requests. | | `redirect_http` | Redirect pages from HTTP to HTTPS, true/false. | +| `redirects_max_config_size` | The maximum size of the _redirects file, in bytes (default: 65536). | +| `redirects_max_path_segments` | The maximum number of path segments allowed in _redirects rules URLs (default: 25). | +| `redirects_max_rule_count` | The maximum number of rules allowed in _redirects (default: 1000). | | `sentry_dsn` | The address for sending Sentry crash reporting to. | | `sentry_enabled` | Enable reporting and logging with Sentry, true/false. | | `sentry_environment` | The environment for Sentry crash reporting. | @@ -577,6 +580,17 @@ HTTP Strict Transport Security (HSTS) can be enabled through the `gitlab_pages[' gitlab_pages['headers'] = ['Strict-Transport-Security: max-age=63072000'] ``` +### Pages project redirects limits + +GitLab Pages comes with a set of default limits for the [`_redirects` file](../../user/project/pages/redirects.md) +to ensure performance is not affected. You can configure these limits if you'd like to increase the limits. + +```ruby +gitlab_pages['redirects_max_config_size'] = 131072 +gitlab_pages['redirects_max_path_segments'] = 50 +gitlab_pages['redirects_max_rule_count'] = 2000 +``` + ## Activate verbose logging for daemon Follow the steps below to configure verbose logging of GitLab Pages daemon. diff --git a/doc/user/project/pages/redirects.md b/doc/user/project/pages/redirects.md index 791b6a1550a45e..5d03db4bf0047d 100644 --- a/doc/user/project/pages/redirects.md +++ b/doc/user/project/pages/redirects.md @@ -45,8 +45,9 @@ Note that: - All paths must start with a forward slash `/`. - A default status code of `301` is applied if no [status code](#http-status-codes) is provided. -- The `_redirects` file has a file size limit of 64KB and a maximum of 1,000 rules per project. - Only the first 1,000 rules are processed. +- The `_redirects` file has a file size limit and a maximum number of rules per project, + configured at the instance level. Only the first matching rules within the configured maximum are processed. + The default file size limit is 64KB, and the default maximum number of rules is 1,000. - If your GitLab Pages site uses the default domain name (such as `namespace.gitlab.io/projectname`) you must prefix every rule with the project name: -- GitLab From 2b88ae0708e3729b2f8a4651b36720806125c883 Mon Sep 17 00:00:00 2001 From: Russell Dickenson Date: Wed, 22 Jun 2022 18:02:38 +0000 Subject: [PATCH 2/4] Apply review suggestion --- doc/administration/pages/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/administration/pages/index.md b/doc/administration/pages/index.md index 65cc34c0cd50c1..60f765d78f5534 100644 --- a/doc/administration/pages/index.md +++ b/doc/administration/pages/index.md @@ -583,7 +583,7 @@ gitlab_pages['headers'] = ['Strict-Transport-Security: max-age=63072000'] ### Pages project redirects limits GitLab Pages comes with a set of default limits for the [`_redirects` file](../../user/project/pages/redirects.md) -to ensure performance is not affected. You can configure these limits if you'd like to increase the limits. +to minimize the impact on performance. You can configure these limits if you'd like to increase the limits. ```ruby gitlab_pages['redirects_max_config_size'] = 131072 -- GitLab From e5423852d1150876f487b26afd1ab0d56b67bce1 Mon Sep 17 00:00:00 2001 From: Nejc Habjan Date: Wed, 22 Jun 2022 20:18:51 +0200 Subject: [PATCH 3/4] Add version history item --- doc/administration/pages/index.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/administration/pages/index.md b/doc/administration/pages/index.md index 60f765d78f5534..88be6feeef0624 100644 --- a/doc/administration/pages/index.md +++ b/doc/administration/pages/index.md @@ -582,6 +582,8 @@ gitlab_pages['headers'] = ['Strict-Transport-Security: max-age=63072000'] ### Pages project redirects limits +> [Introduced](https://gitlab.com/gitlab-org/gitlab-pages/-/merge_requests/778) in GitLab 15.2. + GitLab Pages comes with a set of default limits for the [`_redirects` file](../../user/project/pages/redirects.md) to minimize the impact on performance. You can configure these limits if you'd like to increase the limits. -- GitLab From 53d07ae75a8cc5b311b4df6981aa122a73a292d6 Mon Sep 17 00:00:00 2001 From: Nejc Habjan Date: Wed, 22 Jun 2022 20:23:07 +0200 Subject: [PATCH 4/4] Add wording on decreasing _redirects limits --- doc/administration/pages/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/administration/pages/index.md b/doc/administration/pages/index.md index 88be6feeef0624..b58eeff48cfee9 100644 --- a/doc/administration/pages/index.md +++ b/doc/administration/pages/index.md @@ -585,7 +585,7 @@ gitlab_pages['headers'] = ['Strict-Transport-Security: max-age=63072000'] > [Introduced](https://gitlab.com/gitlab-org/gitlab-pages/-/merge_requests/778) in GitLab 15.2. GitLab Pages comes with a set of default limits for the [`_redirects` file](../../user/project/pages/redirects.md) -to minimize the impact on performance. You can configure these limits if you'd like to increase the limits. +to minimize the impact on performance. You can configure these limits if you'd like to increase or decrease the limits. ```ruby gitlab_pages['redirects_max_config_size'] = 131072 -- GitLab