Administration Less-Frequently-Asked Questions

How do I set up redirect URLs in Sourcegraph?

Sometimes URLs in Sourcegraph may change. For example, if a code host configuration is updated to use a different repositoryPathPattern, this will change the repository URLs on Sourcegraph. Users may wish to preserve links to the old URLs, and this requires adding redirects.

We recommend configuring redirects in a reverse proxy. If you are running Sourcegraph as a single Docker image, you can deploy a reverse proxy such as Caddy or NGINX in front of it. Refer to the Caddy or NGINX documentation for URL rewrites.

If you are running Sourcegraph as a Kubernetes cluster, you have two additional options:

  1. If you are using NGINX ingress (kubectl get ingress | grep sourcegraph-frontend), modify sourcegraph-frontend.Ingress.yaml by adding a rewrite rule.
  2. If you are using the NGINX service, modify nginx.ConfigMap.yaml.