Difference between revisions of "Gitlab recipes"

From ElphelWiki
Jump to: navigation, search
(Created page with "==X-Frame-Options header== * Edit: ''/opt/gitlab/embedded/service/gitlab-rails/app/controllers/application_controller.rb'' in '''def default_headers''': -headers['X-Frame-Opt...")
 
Line 1: Line 1:
==X-Frame-Options header==
+
==X-Frame headers==
 +
===X-Frame-Options header===
 
* Edit: ''/opt/gitlab/embedded/service/gitlab-rails/app/controllers/application_controller.rb'' in '''def default_headers''':
 
* Edit: ''/opt/gitlab/embedded/service/gitlab-rails/app/controllers/application_controller.rb'' in '''def default_headers''':
 
  -headers['X-Frame-Options'] = 'DENY'
 
  -headers['X-Frame-Options'] = 'DENY'
Line 5: Line 6:
 
* Restart services
 
* Restart services
 
  gitlab-ctl restart
 
  gitlab-ctl restart
 +
 +
 +
==nginx behind apache2 misconfiguration==
 +
===Error log===
 +
gitlab bind() to 0.0.0.0:80 failed (98: Address already in use)
 +
===Versions===
 +
GitLab 10.5.1
 +
GitLab Shell 6.0.3
 +
GitLab Workhorse v3.6.0
 +
GitLab API v4
 +
Ruby 2.3.6p384
 +
Rails 4.2.10
 +
postgresql 9.6.5
 +
===Problem===
 +
* /etc/gitlab/gitlab.rb:
 +
# nginx['enable'] = true
 +
# nginx['client_max_body_size'] = '250m'
 +
# nginx['redirect_http_to_https'] = false
 +
# nginx['redirect_http_to_https_port'] = 80
 +
 +
''redirect_http_to_https'' default option is probably '''true''' or is ignored resulting in a nginx config record:
 +
 +
* /var/opt/gitlab/nginx/conf/gitlab-http.conf:
 +
server {
 +
  listen *:80;
 +
  ...
 +
}
 +
 +
which is in conflict with Apache
 +
 +
===Solution===
 +
In ''/etc/gitlab/gitlab.rb'' uncommented and changed '''nginx['redirect_http_to_https_port']''' to another port

Revision as of 11:40, 26 February 2018

X-Frame headers

X-Frame-Options header

  • Edit: /opt/gitlab/embedded/service/gitlab-rails/app/controllers/application_controller.rb in def default_headers:
-headers['X-Frame-Options'] = 'DENY'
+headers['X-Frame-Options'] = 'ALLOW-FROM https://www.elphel.com/'
  • Restart services
gitlab-ctl restart


nginx behind apache2 misconfiguration

Error log

gitlab bind() to 0.0.0.0:80 failed (98: Address already in use)

Versions

GitLab 10.5.1 GitLab Shell 6.0.3 GitLab Workhorse v3.6.0 GitLab API v4 Ruby 2.3.6p384 Rails 4.2.10 postgresql 9.6.5

Problem

  • /etc/gitlab/gitlab.rb:
# nginx['enable'] = true
# nginx['client_max_body_size'] = '250m'
# nginx['redirect_http_to_https'] = false
# nginx['redirect_http_to_https_port'] = 80

redirect_http_to_https default option is probably true or is ignored resulting in a nginx config record:

  • /var/opt/gitlab/nginx/conf/gitlab-http.conf:
server {
  listen *:80;
  ...
}

which is in conflict with Apache

Solution

In /etc/gitlab/gitlab.rb uncommented and changed nginx['redirect_http_to_https_port'] to another port