Changing the default Gitlab port

后端 未结 3 1236
你的背包
你的背包 2021-02-06 15:11

I have installed the latest Gitlab-CE (8.10) on CentOS 7 (fresh install) via the Omnibus package as described here: https://about.gitlab.com/downloads/#centos7

Now, I wo

3条回答
  •  深忆病人
    2021-02-06 15:34

    In addition of external_url, the documentation also suggests to set a few NGiNX proxy headers:

    By default, when you specify external_url, omnibus-gitlab will set a few NGINX proxy headers that are assumed to be sane in most environments.

    For example, omnibus-gitlab will set:

    "X-Forwarded-Proto" => "https",
    "X-Forwarded-Ssl" => "on"
    

    (if you have specified https schema in the external_url).

    However, if you have a situation where your GitLab is in a more complex setup like behind a reverse proxy, you will need to tweak the proxy headers in order to avoid errors like The change you wanted was rejected or Can't verify CSRF token authenticity Completed 422 Unprocessable.

    This can be achieved by overriding the default headers, eg. specify in /etc/gitlab/gitlab.rb:

     nginx['proxy_set_headers'] = {
      "X-Forwarded-Proto" => "http",
      "CUSTOM_HEADER" => "VALUE"
     }
    

    Save the file and reconfigure GitLab for the changes to take effect.

    This way you can specify any header supported by NGINX you require.

    The OP ewcz confirms in the comments:

    I just uncommented the default settings for nginx['proxy_set_headers'] in /etc/gitlab/gitlab.rb (also, changing X-Forwarded-Proto to http and removing X-Forwarded-Ssl) and suddenly it works!

提交回复
热议问题