Skip to content

Commit 75e78f1

Browse files
author
Nick Thomas
committed
The GitLab Pages external-http and external-https arguments can be specified multiple times
1 parent d34300e commit 75e78f1

File tree

5 files changed

+25
-20
lines changed

5 files changed

+25
-20
lines changed

config/gitlab.yml.example

+2-2
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ production: &base
157157
host: example.com
158158
port: 80 # Set to 443 if you serve the pages with HTTPS
159159
https: false # Set to true if you serve the pages with HTTPS
160-
# external_http: "1.1.1.1:80" # If defined, enables custom domain support in GitLab Pages
161-
# external_https: "1.1.1.1:443" # If defined, enables custom domain and certificate support in GitLab Pages
160+
# external_http: ["1.1.1.1:80", "[2001::1]:80"] # If defined, enables custom domain support in GitLab Pages
161+
# external_https: ["1.1.1.1:443", "[2001::1]:443"] # If defined, enables custom domain and certificate support in GitLab Pages
162162

163163
## Mattermost
164164
## For enabling Add to Mattermost button

config/initializers/1_settings.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,8 @@ def host(url)
278278
Settings.pages['port'] ||= Settings.pages.https ? 443 : 80
279279
Settings.pages['protocol'] ||= Settings.pages.https ? "https" : "http"
280280
Settings.pages['url'] ||= Settings.send(:build_pages_url)
281-
Settings.pages['external_http'] ||= false if Settings.pages['external_http'].nil?
282-
Settings.pages['external_https'] ||= false if Settings.pages['external_https'].nil?
281+
Settings.pages['external_http'] ||= false unless Settings.pages['external_http'].present?
282+
Settings.pages['external_https'] ||= false unless Settings.pages['external_https'].present?
283283

284284
#
285285
# Git LFS

doc/administration/pages/index.md

+16-11
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ it works.
2626

2727
---
2828

29-
In the case of [custom domains](#custom-domains) (but not
30-
[wildcard domains](#wildcard-domains)), the Pages daemon needs to listen on
31-
ports `80` and/or `443`. For that reason, there is some flexibility in the way
29+
In the case of [custom domains](#custom-domains) (but not
30+
[wildcard domains](#wildcard-domains)), the Pages daemon needs to listen on
31+
ports `80` and/or `443`. For that reason, there is some flexibility in the way
3232
which you can set it up:
3333

3434
1. Run the Pages daemon in the same server as GitLab, listening on a secondary IP.
@@ -65,11 +65,13 @@ you need to add a [wildcard DNS A record][wiki-wildcard-dns] pointing to the
6565
host that GitLab runs. For example, an entry would look like this:
6666

6767
```
68-
*.example.io. 1800 IN A 1.1.1.1
68+
*.example.io. 1800 IN A 1.1.1.1
69+
*.example.io. 1800 IN AAAA 2001::1
6970
```
7071

7172
where `example.io` is the domain under which GitLab Pages will be served
72-
and `1.1.1.1` is the IP address of your GitLab instance.
73+
and `1.1.1.1` is the IPv4 address of your GitLab instance and `2001::1` is the
74+
IPv6 address. If you don't have IPv6, you can omit the AAAA record.
7375

7476
> **Note:**
7577
You should not use the GitLab domain to serve user pages. For more information
@@ -141,7 +143,8 @@ outside world.
141143
In addition to the wildcard domains, you can also have the option to configure
142144
GitLab Pages to work with custom domains. Again, there are two options here:
143145
support custom domains with and without TLS certificates. The easiest setup is
144-
that without TLS certificates.
146+
that without TLS certificates. In either case, you'll need a secondary IP. If
147+
you have IPv6 as well as IPv4 addresses, you can use them both.
145148

146149
### Custom domains
147150

@@ -163,11 +166,12 @@ world. Custom domains are supported, but no TLS.
163166
pages_external_url "http://example.io"
164167
nginx['listen_addresses'] = ['1.1.1.1']
165168
pages_nginx['enable'] = false
166-
gitlab_pages['external_http'] = '1.1.1.2:80'
169+
gitlab_pages['external_http'] = ['1.1.1.2:80', '[2001::2]:80']
167170
```
168171

169172
where `1.1.1.1` is the primary IP address that GitLab is listening to and
170-
`1.1.1.2` the secondary IP where the GitLab Pages daemon listens to.
173+
`1.1.1.2` and `2001::2` are the secondary IPs the GitLab Pages daemon
174+
listens on. If you don't have IPv6, you can omit the IPv6 address.
171175
172176
1. [Reconfigure GitLab][reconfigure]
173177
@@ -194,12 +198,13 @@ world. Custom domains and TLS are supported.
194198
pages_nginx['enable'] = false
195199
gitlab_pages['cert'] = "/etc/gitlab/ssl/example.io.crt"
196200
gitlab_pages['cert_key'] = "/etc/gitlab/ssl/example.io.key"
197-
gitlab_pages['external_http'] = '1.1.1.2:80'
198-
gitlab_pages['external_https'] = '1.1.1.2:443'
201+
gitlab_pages['external_http'] = ['1.1.1.2:80', '[2001::2]:80']
202+
gitlab_pages['external_https'] = ['1.1.1.2:443', '[2001::2]:443']
199203
```
200204
201205
where `1.1.1.1` is the primary IP address that GitLab is listening to and
202-
`1.1.1.2` the secondary IP where the GitLab Pages daemon listens to.
206+
`1.1.1.2` and `2001::2` are the secondary IPs where the GitLab Pages daemon
207+
listens on. If you don't have IPv6, you can omit the IPv6 address.
203208

204209
1. [Reconfigure GitLab][reconfigure]
205210

features/steps/project/pages.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ class Spinach::Features::ProjectPages < Spinach::FeatureSteps
5353
end
5454

5555
step 'pages are exposed on external HTTP address' do
56-
allow(Gitlab.config.pages).to receive(:external_http).and_return('1.1.1.1:80')
56+
allow(Gitlab.config.pages).to receive(:external_http).and_return(['1.1.1.1:80'])
5757
allow(Gitlab.config.pages).to receive(:external_https).and_return(nil)
5858
end
5959

6060
step 'pages are exposed on external HTTPS address' do
61-
allow(Gitlab.config.pages).to receive(:external_http).and_return('1.1.1.1:80')
62-
allow(Gitlab.config.pages).to receive(:external_https).and_return('1.1.1.1:443')
61+
allow(Gitlab.config.pages).to receive(:external_http).and_return(['1.1.1.1:80'])
62+
allow(Gitlab.config.pages).to receive(:external_https).and_return(['1.1.1.1:443'])
6363
end
6464

6565
step 'I should be able to add a New Domain' do

lib/support/init.d/gitlab.default.example

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ gitlab_workhorse_log="$app_root/log/gitlab-workhorse.log"
5656
# The value of -listen-http must be set to `gitlab.yml > pages > external_http`
5757
# as well. For example:
5858
#
59-
# -listen-http 1.1.1.1:80
59+
# -listen-http 1.1.1.1:80 -listen-http [2001::1]:80
6060
#
6161
# To enable HTTPS support for custom domains add the `-listen-https`,
6262
# `-root-cert` and `-root-key` directives in `gitlab_pages_options` below.
6363
# The value of -listen-https must be set to `gitlab.yml > pages > external_https`
6464
# as well. For example:
6565
#
66-
# -listen-https 1.1.1.1:443 -root-cert /path/to/example.com.crt -root-key /path/to/example.com.key
66+
# -listen-https 1.1.1.1:443 -listen-http [2001::1]:443 -root-cert /path/to/example.com.crt -root-key /path/to/example.com.key
6767
#
6868
# The -pages-domain must be specified the same as in `gitlab.yml > pages > host`.
6969
# Set `gitlab_pages_enabled=true` if you want to enable the Pages feature.

0 commit comments

Comments
 (0)