Create a filter that intercepts incoming requests and redirects them to a different URL based on a configurable set of redirect rules.
The filter should support both 301 (Moved Permanently) and 302 (Found / Temporary Redirect) responses.
Requirements
Support a configurable list of redirect rules, each containing:
When a request matches a rule:
Ensure rules are evaluated in order
Log each redirect for debugging
Add tests for:
Examples
Create a filter that intercepts incoming requests and redirects them to a different URL based on a configurable set of redirect rules.
The filter should support both 301 (Moved Permanently) and 302 (Found / Temporary Redirect) responses.
Requirements
Support a configurable list of redirect rules, each containing:
sourcePath (string or regex)
targetUrl
statusCode (301 or 302)
When a request matches a rule:
Stop the pipeline
Return a redirect response with the correct Location header
Ensure rules are evaluated in order
Log each redirect for debugging
Add tests for:
301 redirect
302 redirect
No matching rule
Regex or wildcard matching (if implemented)
Examples
/old-page → /new-page (301)
/temp → https://example.com/temporary (302)
/docs/* → /documentation/ (301, wildcard)