GitLab Pages custom domains
- Tier: Free, Premium, Ultimate
- Offering: GitLab.com, GitLab Self-Managed
You can use custom domains:
- With GitLab Pages.
- To bypass user email confirmation for SAML- or SCIM-provisioned users. When using custom domains this way, you use the GitLab Pages feature but can skip the prerequisites.
To use one or more custom domain names:
You cannot verify the most popular public email domains.
Set up a custom domain
To set up Pages with a custom domain, complete the following steps.
Prerequisites
- An administrator has configured the server for GitLab Pages custom domains.
- A GitLab Pages website up and running, served under the default Pages domain
(
*.gitlab.io, for GitLab.com). - A custom domain name
example.comor subdomainsubdomain.example.com. - Access to your domain’s server control panel to set up DNS records:
- A DNS record (
A,AAAA,ALIAS, orCNAME) pointing your domain to the GitLab Pages server. If there are multiple DNS records on that name, you must use anALIASrecord. - A DNS
TXTrecord to verify your domain’s ownership.
- A DNS record (
For an overview on DNS records, see GitLab Pages DNS records.
Step 1: Add a custom domain
To add your custom domain to GitLab Pages:
- On the top bar, select Search or go to and find your project.
- Select Deploy > Pages.
- In the upper-right corner, select New Domain.
- In Domain, enter the domain name.
- Optional. In Certificate, turn off the Automatic certificate management using Let’s Encrypt toggle to add an SSL/TLS certificate. You can also add the certificate and key later.
- Select Create New Domain.
Step 2: Get the verification code
After you add a new domain to Pages, GitLab displays a verification code. Copy the values
and paste them in your domain’s control panel as a TXT record in the next step.
The structure of the Verification status field is:
- Name/Host:
- For root domains:
_gitlab-pages-verification-code.example.com - For subdomains:
_gitlab-pages-verification-code.subdomain.example.com
- For root domains:
- DNS record type:
TXT - Value:
gitlab-pages-verification-code=00112233445566778899aabbccddeeff(use your actual code from GitLab)
Some DNS providers, like Cloudflare, automatically append your domain name to the
Name or Host field. If your provider does this, enter only
_gitlab-pages-verification-code for root domains or
_gitlab-pages-verification-code.subdomain for subdomains.
Step 3: Set up DNS records
To set up DNS records according to the type of domain you want to use with your Pages site, choose one of the following:
For root domains
Root domains (example.com) require:
- At least one of:
- A DNS
Arecord pointing your domain to the Pages server. - A DNS
AAAArecord pointing your domain to the Pages server.
- A DNS
- A
TXTrecord to verify your domain’s ownership.
| From | DNS record | To |
|---|---|---|
example.com | A | 35.185.44.232 |
example.com | AAAA | 2600:1901:0:7b8a:: |
_gitlab-pages-verification-code.example.com | TXT | gitlab-pages-verification-code=00112233445566778899aabbccddeeff |
For projects on GitLab.com, the IPv4 address is 35.185.44.232 and the IPv6 address
is 2600:1901:0:7b8a::.
For projects in other GitLab instances (CE or EE), contact your system administrator and request the Pages server IP address for your instance.
You should not use a DNS apex CNAME record instead of an A or AAAA record for your root domain.
This method most likely does not work if you set an
MX record for your root domain.
For subdomains
Subdomains (subdomain.example.com) require:
- A DNS
ALIASorCNAMErecord pointing your subdomain to the Pages server. - A DNS
TXTrecord to verify your domain’s ownership.
| From | DNS Record | To |
|---|---|---|
subdomain.example.com | ALIAS/CNAME | namespace.gitlab.io |
_gitlab-pages-verification-code.subdomain.example.com | TXT | gitlab-pages-verification-code=00112233445566778899aabbccddeeff |
Whether it’s a user or a project website, the DNS record
should point to your Pages domain (namespace.gitlab.io),
without any path.
For both root and subdomains
To point both the root domain and subdomain to the same website, for example,
example.com and www.example.com, you need the following:
- A DNS
Arecord for the domain. - A DNS
AAAArecord for the domain. - A DNS
ALIAS/CNAMErecord for the subdomain. - A DNS
TXTrecord for each.
| From | DNS Record | To |
|---|---|---|
example.com | A | 35.185.44.232 |
example.com | AAAA | 2600:1901:0:7b8a:: |
_gitlab-pages-verification-code.example.com | TXT | gitlab-pages-verification-code=00112233445566778899aabbccddeeff |
www.example.com | CNAME | namespace.gitlab.io |
_gitlab-pages-verification-code.www.example.com | TXT | gitlab-pages-verification-code=00112233445566778899aabbccddeeff |
If you’re using Cloudflare, see
redirecting www.domain.com to domain.com with Cloudflare.
Additionally:
- Do not use a
CNAMErecord if you want to point yourdomain.comto your GitLab Pages site. Use anArecord instead. - Do not add any special chars after the default Pages
domain. For example, do not point
subdomain.domain.comto ornamespace.gitlab.io/. Some domain hosting providers may request a trailing dot (namespace.gitlab.io.). - GitLab Pages IP on GitLab.com was changed in 2017.
- GitLab Pages IP on GitLab.com has changed
from
52.167.214.135to35.185.44.232in 2018. - IPv6 support was added to GitLab.com in 2023.
Step 4: Verify the domain’s ownership
After you have added all the DNS records:
- On the top bar, select Search or go to and find your project.
- Select Deploy > Pages.
- Next to the domain name, select Edit ( ).
- In Verification status, select Retry verification ( ).
When your domain becomes active, your website is available through your domain name.
On GitLab instances with domain verification enabled, GitLab removes unverified domains from the project after 7 days.
Additionally:
- Domain verification is required for GitLab.com users. For GitLab Self-Managed, your GitLab administrator has the option to disabled custom domain verification.
- DNS propagation may take some time (up to 24 hours), although it’s usually a matter of minutes to complete. Until it does, verification fails, and attempts to visit your domain result in a 404.
- After your domain is verified, leave the verification record in place. Your domain is periodically reverified, and may be disabled if the record is removed.
Add more domain aliases
You can add more than one alias (custom domains and subdomains) to the same project. An alias can be understood as having many doors leading to the same room.
All the aliases you’ve set to your site are listed on Setting > Pages. From that page, you can view, add, and remove them.
Redirect www.domain.com to domain.com with Cloudflare
If you use Cloudflare, you can use page rules to redirect www.domain.com to domain.com
without adding both domains to GitLab:
- In Cloudflare, create at least one of:
- A DNS
Arecord pointingdomain.comto35.185.44.232. - A DNS
AAAArecord pointingdomain.comto2600:1901:0:7b8a::.
- A DNS
- In GitLab, add the domain to GitLab Pages and get the verification code.
- In Cloudflare, create a DNS
TXTrecord to verify your domain. - In GitLab, verify your domain.
- In Cloudflare, create a DNS
CNAMErecord pointingwwwtodomain.com. - In Cloudflare, add a Page Rule pointing
www.domain.comtodomain.com:- Go to your domain’s dashboard. On the top navigation, select Page Rules.
- Select Create Page Rule.
- Enter the domain
www.domain.comand select + Add a Setting. - From the dropdown list, choose Forwarding URL, then select the status code 301 - Permanent Redirect.
- Enter the destination URL
https://domain.com.
Add an SSL/TLS certificate to Pages
To secure your custom domain with GitLab Pages, you can:
- Use the Let’s Encrypt integration to automatically obtain and renew SSL certificates.
- Manually add SSL/TLS certificates.
For an overview of SSL/TLS certification, see GitLab Pages SSL/TLS certificates.
Manually add SSL/TLS certificates
Prerequisites:
A GitLab Pages website up and running, accessible on a custom domain.
The following certificate components:
- PEM certificate: The certificate generated by the CA.
- Intermediate certificate: Also called a root certificate, this identifies the CA. Usually combined with the PEM certificate, but some certificates like Cloudflare certificates require you to add them separately.
- Private key: An encrypted key that validates your PEM against your domain.
To add a certificate when you create a new domain:
- On the top bar, select Search or go to and find your project.
- Select Deploy > Pages.
- In the upper-right corner, select New Domain.
- In Domain, enter the domain name.
- In Certificate, turn off the Automatic certificate management using Let’s Encrypt toggle.
- Complete the certificate fields.
- Select Create New Domain.
To add a certificate to an existing domain:
- On the top bar, select Search or go to and find your project.
- Select Deploy > Pages.
- Next to the domain name, select Edit ( ).
- In Certificate, turn off the Automatic certificate management using Let’s Encrypt toggle.
- Complete the certificate fields.
- Select Save changes.
When you complete the certificate fields:
- In Certificate (PEM), paste the PEM certificate. If your certificate requires a separate intermediate certificate, paste it in the same field, separated by a blank line. For more information, see Setting up GitLab Pages with Cloudflare certificates.
- In the private key field, paste your private key.
Do not open certificates or encryption keys in regular text editors. Use code editors like Sublime Text, Dreamweaver, or VS Code.
Force HTTPS for GitLab Pages websites
You can force HTTPS for GitLab Pages to automatically redirect HTTP requests to HTTPS with a 301 redirect. This works with the default GitLab Pages domain and custom domains with a valid certificate.
To force HTTPS:
- On the top bar, select Search or go to and find your project.
- Select Deploy > Pages.
- Select the Force HTTPS (requires valid certificates) checkbox.
- Select Save changes.
If you use Cloudflare CDN in front of GitLab Pages, set the SSL connection setting to
full instead of flexible. For more information, see the
Cloudflare CDN directions.
Edit a custom domain
You can edit a custom domain to:
- View the custom domain.
- View the DNS record to add.
- View the TXT verification entry.
- Retry verification.
- Edit the certificate settings.
To edit a custom domain:
- On the top bar, select Search or go to and find your project.
- Select Deploy > Pages.
- Next to the domain name, select Edit ( ).
Delete a custom domain
After a custom domain is deleted, the domain is no longer verified in GitLab and cannot be used with GitLab Pages.
To delete and remove a custom domain:
- On the top bar, select Search or go to and find your project.
- Select Deploy > Pages.
- Next to the domain name, select Remove domain ( ).
- When prompted, select Remove domain.
Troubleshooting
Domain verification
To manually verify that you have properly configured the domain verification
TXT DNS entry, you can run the following command in your terminal:
dig _gitlab-pages-verification-code.<YOUR-PAGES-DOMAIN> TXTExpect the output:
;; ANSWER SECTION:
_gitlab-pages-verification-code.<YOUR-PAGES-DOMAIN>. 300 IN TXT "gitlab-pages-verification-code=<YOUR-VERIFICATION-CODE>"In some cases it can help to add the verification code with the same domain name as you are trying to register.
For a root domain:
| From | DNS Record | To |
|---|---|---|
example.com | TXT | gitlab-pages-verification-code=00112233445566778899aabbccddeeff |
_gitlab-pages-verification-code.example.com | TXT | gitlab-pages-verification-code=00112233445566778899aabbccddeeff |
For a subdomain:
| From | DNS Record | To |
|---|---|---|
www.example.com | TXT | gitlab-pages-verification-code=00112233445566778899aabbccddeeff |
_gitlab-pages-verification-code.www.example.com | TXT | gitlab-pages-verification-code=00112233445566778899aabbccddeeff |


