Setup redirection using Caddy¶
Grove supports setting up URL redirections through Caddy via the GROVE_REDIRECTS setting in each instance's config.yml.
This uses Caddy's redir directive
GROVE_REDIRECTS is a list of dictionaries with the following keys.
domaincan be any domain, not necessarily a subdomain of the LMS/CMS. Set up the DNS to redirect to your cluster. This is mandatory.rulesis a list of dictionaries defining the redirect rules to be setup for this domain. This key is mandatory. Each dictionary listed here can have the following keys:tois used to set the target location. Becomes the response's Location header. This can be just a path such as/exampleor a full url such ashttps://example.com. This is a mandatory key.pathThis is an optional key. If set the redirect rule will apply to only this particular path. If not set, then this rule will apply to all paths of the domain.codeDefaults to301if nothing provided. Can be used to set the HTTP status code to use for the redirect.
Here's a sample usage of the GROVE_REDIRECTS setting.
GROVE_REDIRECTS:
- domain: lms.example.net
rules:
- to: https://example.org
code: 302
- domain: lms.example.com
rules:
- path: /account
to: /dashboard
- path: /u/*
to: /dashboard