response.redirect: extract special-cased back, fixes #904 by fl0w · Pull Request #1115 · koajs/koa (original) (raw)
fl0w mentioned this pull request
fl0w mentioned this pull request
titanism added a commit to forwardemail/forwardemail.net that referenced this pull request
…oa v3
Koa v3 removes ctx.redirect('back') and replaces it with ctx.back(fallbackUrl). This polyfill intercepts ctx.redirect('back') calls and converts them to use the Referer header with a fallback URL, maintaining backward compatibility with the 34 existing usages in the codebase.
- Add helpers/koa-redirect-back-polyfill.js middleware
- Apply polyfill to web, api, caldav, and carddav servers via hookBeforeSetup
- No changes needed to existing controller code
- Supports localized fallback URLs via ctx.state.l()
@see https://github.com/koajs/koa/releases/tag/v3.0.0 @see koajs/koa#1115
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})