diff --git a/doc/api/pages.md b/doc/api/pages.md index de316a51c526d9248e30f2ecbdb6bce45934cf2d..3ac4bb5806e63e08edbc4f52cc14766a6842b3c2 100644 --- a/doc/api/pages.md +++ b/doc/api/pages.md @@ -63,6 +63,7 @@ response attributes: | `is_unique_domain_enabled` | boolean | If [unique domain](../user/project/pages/introduction.md) is enabled. | | `force_https` | boolean | `true` if the project is set to force HTTPS. | | `deployments[]` | array | List of current active deployments. | +| `primary_domain` | string | Primary domain to redirect all Pages requests to. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/481334) in GitLab 17.8. | | `deployments[]` attribute | Type | Description | | ----------------------------------------- | ---------- |-------------------------------------------------------------------------------------------------------------------------------| @@ -97,7 +98,8 @@ Example response: "path_prefix": "mr3", "root_directory": null } - ] + ], + "primary_domain": null } ``` @@ -122,6 +124,7 @@ Supported attributes: | `id` | integer/string | Yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-paths) | | `pages_unique_domain_enabled` | boolean | No | Whether to use unique domain | | `pages_https_only` | boolean | No | Whether to force HTTPs | +| `pages_primary_domain` | string | No | Set the primary domain from the existing assigned domains to redirect all Pages requests to. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/481334) in GitLab 17.8. | If successful, returns [`200`](rest/troubleshooting.md#status-codes) and the following response attributes: @@ -132,6 +135,7 @@ response attributes: | `is_unique_domain_enabled` | boolean | If [unique domain](../user/project/pages/introduction.md) is enabled. | | `force_https` | boolean | `true` if the project is set to force HTTPS. | | `deployments[]` | array | List of current active deployments. | +| `primary_domain` | string | Primary domain to redirect all Pages requests to. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/481334) in GitLab 17.8. | | `deployments[]` attribute | Type | Description | | ----------------------------------------- | ---------- |-------------------------------------------------------------------------------------------------------------------------------| @@ -143,8 +147,12 @@ response attributes: Example request: ```shell -curl --request PATCH --header "PRIVATE-TOKEN: <your_access_token>" --url "https://gitlab.example.com/api/v4/projects/:id/pages" \ ---form 'pages_unique_domain_enabled=true' --form 'pages_https_only=true' +curl --request PATCH \ + --header "PRIVATE-TOKEN: <your_access_token>" \ + --url "https://gitlab.example.com/api/v4/projects/:id/pages" \ + --form 'pages_unique_domain_enabled=true' \ + --form 'pages_https_only=true' \ + --form 'pages_primary_domain=https://custom.example.com' ``` Example response: @@ -167,6 +175,7 @@ Example response: "path_prefix": "mr3", "root_directory": null } - ] + ], + "primary_domain": null } ``` diff --git a/doc/user/project/pages/index.md b/doc/user/project/pages/index.md index bea4438afc9d8681d3115c9e1fb669461e7fe70d..ca529982485aa059f99a842922a1c9e9a6d248ca 100644 --- a/doc/user/project/pages/index.md +++ b/doc/user/project/pages/index.md @@ -178,6 +178,22 @@ The project maintainer can disable this feature on: For example URLs, see [GitLab Pages default domain names](getting_started_part_one.md#gitlab-pages-default-domain-names). +## Primary domain + +> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/481334) in GitLab 17.8. + +When you use GitLab Pages with custom domains, you can redirect all requests to GitLab Pages to a primary domain. + +Prerequisites: + +- You must have at least the Maintainer role for the project. +- A [custom domain](custom_domains_ssl_tls_certification/index.md#set-up-a-custom-domain) must be set up. + +1. On the left sidebar, select **Search or go to** and find your project. +1. Select **Deploy > Pages**. +1. From the **Primary domain** dropdown list, select the domain to redirect to. +1. Select **Save changes**. + ## Expiring deployments DETAILS: