Skip to content

Add redirect handled callback#421

Closed
mjarosch wants to merge 1 commit into
Sitecore:devfrom
mjarosch:feature/redirect-handled-callback
Closed

Add redirect handled callback#421
mjarosch wants to merge 1 commit into
Sitecore:devfrom
mjarosch:feature/redirect-handled-callback

Conversation

@mjarosch
Copy link
Copy Markdown

@mjarosch mjarosch commented Apr 1, 2026

Add a redirect handled callback so that analytics can be collected for redirects. This is a POC implementation of #420.

Description / Motivation

  1. Added an optional redirectHandled parameter to RedirectsProxyConfig
  2. Added a HandledRedirectInfo type to represent the handled redirect that is passed to the callback
  3. Added a check to the dispatchRedirect method to call the redirectHandled callback if provided. It uses the Vercel after function so that it doesn't block the proxy

Testing Details

Added a unit test to validate that callback is called when supplied.

  • Unit Test Added
  • Manual Test/Other (Please elaborate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

@sc-nikolaoslazaridis
Copy link
Copy Markdown
Contributor

Hello @mjarosch, thank you for putting together this PoC, it really helped us validate the direction we want to take.
We created an internal ticket for this new feature and the result of that is this PR: #490. The implementation is different but it should serve your needs. You can find an example of how to use it in the PR description. I will close this PR and if you have any other feedback please use the following discussion #420.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants