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!
Files
2
+ 8
8
@@ -70,7 +70,7 @@ response attributes:
@@ -70,7 +70,7 @@ response attributes:
| `url` | string | URL for this deployment. |
| `url` | string | URL for this deployment. |
| `path_prefix` | string | Path prefix of this deployment when using [parallel deployments](../user/project/pages/index.md#parallel-deployments). |
| `path_prefix` | string | Path prefix of this deployment when using [parallel deployments](../user/project/pages/index.md#parallel-deployments). |
| `root_directory` | string | Root directory. |
| `root_directory` | string | Root directory. |
| `default_domain_redirect` | string | Default domain where all Pages requests will be redirected. |
| `primary_domain` | string | Primary domain where all Pages requests will be redirected. |
Example request:
Example request:
@@ -91,14 +91,14 @@ Example response:
@@ -91,14 +91,14 @@ Example response:
"url": "http://html-root-4160ce5f0e9a6c90ccb02755b7fc80f5a2a09ffbb1976cf80b653.pages.gdk.test:3010/",
"url": "http://html-root-4160ce5f0e9a6c90ccb02755b7fc80f5a2a09ffbb1976cf80b653.pages.gdk.test:3010/",
"path_prefix": "",
"path_prefix": "",
"root_directory": null,
"root_directory": null,
"default_domain_redirect": null
"primary_domain": null
},
},
{
{
"created_at": "2024-01-05T18:58:46.042Z",
"created_at": "2024-01-05T18:58:46.042Z",
"url": "http://html-root-4160ce5f0e9a6c90ccb02755b7fc80f5a2a09ffbb1976cf80b653.pages.gdk.test:3010/mr3",
"url": "http://html-root-4160ce5f0e9a6c90ccb02755b7fc80f5a2a09ffbb1976cf80b653.pages.gdk.test:3010/mr3",
"path_prefix": "mr3",
"path_prefix": "mr3",
"root_directory": null,
"root_directory": null,
"default_domain_redirect": null
"primary_domain": null
}
}
]
]
}
}
@@ -125,7 +125,7 @@ Supported attributes:
@@ -125,7 +125,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_default_domain_redirect` | string | No | Set the default 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 which all Pages requests will be redirected. |
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:
@@ -143,13 +143,13 @@ response attributes:
@@ -143,13 +143,13 @@ response attributes:
| `url` | string | URL for this deployment. |
| `url` | string | URL for this deployment. |
| `path_prefix` | string | Path prefix of this deployment when using [parallel deployments](../user/project/pages/index.md#parallel-deployments). |
| `path_prefix` | string | Path prefix of this deployment when using [parallel deployments](../user/project/pages/index.md#parallel-deployments). |
| `root_directory` | string | Root directory. |
| `root_directory` | string | Root directory. |
| `default_domain_redirect` | string | Default domain where all Pages requests will be redirected. |
| `primary_domain` | string | Primary domain where all Pages requests will be redirected. |
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 --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_default_domain_redirect=https://custom.example.com'
--form 'pages_unique_domain_enabled=true' --form 'pages_https_only=true' --form 'pages_primary_domain=https://custom.example.com'
```
```
Example response:
Example response:
@@ -165,14 +165,14 @@ Example response:
@@ -165,14 +165,14 @@ Example response:
"url": "http://html-root-4160ce5f0e9a6c90ccb02755b7fc80f5a2a09ffbb1976cf80b653.pages.gdk.test:3010/",
"url": "http://html-root-4160ce5f0e9a6c90ccb02755b7fc80f5a2a09ffbb1976cf80b653.pages.gdk.test:3010/",
"path_prefix": "",
"path_prefix": "",
"root_directory": null,
"root_directory": null,
"default_domain_redirect": null
"primary_domain": null
},
},
{
{
"created_at": "2024-01-05T18:58:46.042Z",
"created_at": "2024-01-05T18:58:46.042Z",
"url": "http://html-root-4160ce5f0e9a6c90ccb02755b7fc80f5a2a09ffbb1976cf80b653.pages.gdk.test:3010/mr3",
"url": "http://html-root-4160ce5f0e9a6c90ccb02755b7fc80f5a2a09ffbb1976cf80b653.pages.gdk.test:3010/mr3",
"path_prefix": "mr3",
"path_prefix": "mr3",
"root_directory": null,
"root_directory": null,
"default_domain_redirect": null
"primary_domain": null
}
}
]
]
}
}
Loading