Changed external_url, how to redirect old url calls to new subdomain

How can I define a redirect rule for nginx in gitlab.rb?

Here’s my scenario:

  1. I have gitlab running well with letsencrypt certificates on:

  2. I want to move to:

  3. I modified giltab.rb external_url and reconfigure successfully, now everything runs on the new domain.

A lot of people will keep calling the old URL which now have no valid certificates and show a very ugly message.

I’m trying to add a nginx redirect from every call into

I cannot do that directly as nginx config is managed by gitlab, any ideas how to do this in /etc/gilab/gitlab.rb