Add splat and placeholder support to _redirects
What does this MR do?
Adds support for Netlify-style splats (*
) and :placeholders
in _redirects
.
This can be used to route all matches to a single, static path:
/foo/* /bar 200
or to a dynamic path using the placeholders:
/foo/* /bar/:splat 200
/foo/:year/:month/:day /bar/blog/:year-:month-day.html 200
Why?
There are a lot of use cases for this feature, but the killer feature for this is to support single page applications (SPAs) that expect the main index.html
page to be served for all requests. (See #23 (closed))
This can be accomplished with a configuration like this:
/* / 200
Documentation
This new functionality will be documented in gitlab!59803 (merged)
TODO
-
Added the Changelog
(e.g.Changelog: feature
) trailer to the commits that need to be included in the changelog -
Added unit tests (if required) -
Added acceptance tests (if required) -
Documentation (if required) (will be added in gitlab!59803 (merged)) -
Code review guidelines -
Go Style guidelines
Related to #500 (closed)
/_redirects sample with new validations
Edited by Nathan Friend