Cannot redirect to https if both on same port
Created by: OverByThere
Hi there,
If I set my system up to run on port 3123, and I want to redirect users from http to https on that port (i.e. they go to http://server:3123 it should go to https://server:3123).
Using the below settings in gitlab.rb
, this does not work:
external_url 'https://server:3123'
nginx['listen_port'] = 3123
nginx['redirect_http_to_https'] = true
nginx['ssl_client_certificate'] = "/etc/gitlab/ssl/COMODORSAAddTrustCA.crt" # Most root CA's are included by default
nginx['ssl_certificate'] = "/etc/gitlab/ssl/unifiedcert.crt"
nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/local.key"
nginx['ssl_ciphers'] = "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256
I also tried adding nginx['redirect_http_to_https_port'] = 3123
, however this didn't make a difference, other than to cause the server to never start up:
==> /var/log/gitlab/nginx/current <==
2015-09-28_07:35:25.11229 nginx: [warn] conflicting server name "server" on 0.0.0.0:3123, ignored
==> /var/log/gitlab/nginx/gitlab_error.log <==
2015/09/28 08:35:43 [error] 4085#0: *1 no "ssl_certificate" is defined in server listening on SSL port while SSL handshaking, client: (my-ip), server: 0.0.0.0:3123
The second error is caused (I presume) because the first listen block in gitlab-http.conf
Any thoughts would be welcome to assist in setting this up. It could be a bug, or it could just be the fact I'm a newbie, but any assistance is welcome.
There does seem to be a solution on ServerFault however I do not know how to integrate this change.
Thanks