Skip to content
Snippets Groups Projects

Docs: Redirect from GitLab pages URL to custom domain when one exists

Merged Naman Jagdish Gala requested to merge docs/505648-pages-default-domain-redirect into master
All threads resolved!
2 files
+ 17
9
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 9
5
@@ -63,7 +63,7 @@ response attributes:
@@ -63,7 +63,7 @@ response attributes:
| `is_unique_domain_enabled` | boolean | If [unique domain](../user/project/pages/introduction.md) is enabled. |
| `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. |
| `force_https` | boolean | `true` if the project is set to force HTTPS. |
| `deployments[]` | array | List of current active deployments. |
| `deployments[]` | array | List of current active deployments. |
| `primary_domain` | string | Primary domain where all Pages requests will be redirected. |
| `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 |
| `deployments[]` attribute | Type | Description |
| ----------------------------------------- | ---------- |-------------------------------------------------------------------------------------------------------------------------------|
| ----------------------------------------- | ---------- |-------------------------------------------------------------------------------------------------------------------------------|
@@ -124,7 +124,7 @@ Supported attributes:
@@ -124,7 +124,7 @@ Supported attributes:
| `id` | integer/string | Yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-paths) |
| `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_unique_domain_enabled` | boolean | No | Whether to use unique domain |
| `pages_https_only` | boolean | No | Whether to force HTTPs |
| `pages_https_only` | boolean | No | Whether to force HTTPs |
| `pages_primary_domain` | string | No | Set the primary domain from the existing assigned domains to which all Pages requests will be redirected. |
| `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
If successful, returns [`200`](rest/troubleshooting.md#status-codes) and the following
response attributes:
response attributes:
@@ -135,7 +135,7 @@ response attributes:
@@ -135,7 +135,7 @@ response attributes:
| `is_unique_domain_enabled` | boolean | If [unique domain](../user/project/pages/introduction.md) is enabled. |
| `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. |
| `force_https` | boolean | `true` if the project is set to force HTTPS. |
| `deployments[]` | array | List of current active deployments. |
| `deployments[]` | array | List of current active deployments. |
| `primary_domain` | string | Primary domain where all Pages requests will be redirected. |
| `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 |
| `deployments[]` attribute | Type | Description |
| ----------------------------------------- | ---------- |-------------------------------------------------------------------------------------------------------------------------------|
| ----------------------------------------- | ---------- |-------------------------------------------------------------------------------------------------------------------------------|
@@ -147,8 +147,12 @@ response attributes:
@@ -147,8 +147,12 @@ response attributes:
Example request:
Example request:
```shell
```shell
curl --request PATCH --header "PRIVATE-TOKEN: <your_access_token>" --url "https://gitlab.example.com/api/v4/projects/:id/pages" \
curl --request PATCH \
--form 'pages_unique_domain_enabled=true' --form 'pages_https_only=true' --form 'pages_primary_domain=https://custom.example.com'
--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:
Example response:
Loading