Server-side Gitlab URL rewriting?



  • Our old BitBucket server had a URL like this,

    • https://bitbucket.acme.net/scm/acmegroup/acme-project.git

    And, we're wanting to move to GitLab with a DNS switch which has a different URL-convention namely

    • https://gitlab.acme.net/acmegroup/acme-project.git

    The /scm/ is what I'd like to fix. Is there a way to rewrite URLs through configuration of the GitLab server such that I can make

    • https://gitlab.acme.net/scm/acmegroup/acme-project.git

    Redirect to

    • https://gitlab.acme.net/acmegroup/acme-project.git

    Note, I know I can change the "Custom Git clone URL for HTTP(S)" and "Replaces the clone URL root" under GitLab's admin/application_settings/general.



  • GitLab omnibus and self-managed installs ship with NGINX which is exposed and documented here,

    • https://docs.gitlab.com/omnibus/settings/nginx.html#inserting-custom-nginx-settings-into-the-gitlab-server-block

    You basically edit the gitlab.rb file, edit nginx['custom_gitlab_server_config'] and then rerun gitlab-ctl reconfigure to regenerate the nginx confs and restart nginx.



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2