Is it ok to modify gitlab_host via gitlab.rb?

My gitlab instance is not using its bundled nginx. So I configured an external nginx and expose internal GitLab instance to public.

I found that most features are works just find, but when I create a new snippet GitLab redirects me to not the public dns but internal address.
At first, I thought that it might be the problem of nginx server configurations, and it turns out it wasn’t the case.

Then, I found that some config file has to do with snippets has internal address as url.

  • /var/opt/gitlab/gitlab-rails/etc/gitlab.yml
    image

So, I modified gitlab_host in gitlab.rb.

  • /etc/gitlab/gitlab.rb
    image

And after that, it works just fine.
I can see gitlab.yml has correct url as well.

  • /var/opt/gitlab/gitlab-rails/etc/gitlab.yml
    image

But I couldn’t find the config file that modifies gitlab_host as an example.
It is ok to modifying it? If not, what’s the best practice of it?

Note: modifying external_url is not the case in my problem.

It turns out that the external_url thing IS the case.
Once external_url is set I don’t worry about any other url config at all.

It even makes both https and ssh clone url to desired url.
I feel dummy dumb dumb.