diff options
author | Naman Jagdish Gala <ngala@gitlab.com> | 2024-01-08 06:17:10 +0300 |
---|---|---|
committer | Jaime Martinez <jmartinez@gitlab.com> | 2024-01-08 06:17:10 +0300 |
commit | 09f456311d4a937e47a709561b992abaca3fe501 (patch) | |
tree | be6c69a7859813f9b361b8f9bf0b21a1d97d685f /internal/redirects/redirects.go | |
parent | e3e0a2a0f50c363496786c7de2fa5fd966881264 (diff) |
Add support for domain level redirects
Diffstat (limited to 'internal/redirects/redirects.go')
-rw-r--r-- | internal/redirects/redirects.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/internal/redirects/redirects.go b/internal/redirects/redirects.go index 4903518a..2c01f396 100644 --- a/internal/redirects/redirects.go +++ b/internal/redirects/redirects.go @@ -52,8 +52,11 @@ var ( errFailedToParseConfig = errors.New("failed to parse _redirects file") errFailedToParseURL = errors.New("unable to parse URL") errNoDomainLevelRedirects = errors.New("no domain-level redirects to outside sites") + errNoDomainLevelRewrite = errors.New("no domain-level rewrite to outside sites") errNoStartingForwardSlashInURLPath = errors.New("url path must start with forward slash /") + errNoValidStartingInURLPath = errors.New("url path must start with forward slash / or http:// or https://") errNoSplats = errors.New("splats are not enabled. See https://docs.gitlab.com/ee/user/project/pages/redirects.html#feature-flag-for-rewrites") + errMoreThanOneSplats = errors.New("rule cannot contain more than 1 asterisk (*) in its from path") errNoPlaceholders = errors.New("placeholders are not enabled. See https://docs.gitlab.com/ee/user/project/pages/redirects.html#feature-flag-for-rewrites") errNoParams = errors.New("params not supported") errUnsupportedStatus = errors.New("status not supported") @@ -111,7 +114,7 @@ func (r *Redirects) Rewrite(originalURL *url.URL) (*url.URL, int, error) { return nil, 0, ErrNoRedirect } - rule, newPath := r.match(originalURL.Path) + rule, newPath := r.match(originalURL) if rule == nil { return nil, 0, ErrNoRedirect } |