Url rewrite - access value in a Golang plugin post trigger validation?

I am writing a Golang Plugin where I want to access the url that had been rewritten to in the URL rewrite trigger (simple or advanced).

Please can you point me to a code sample for that?

Our use case is we want to use that data in a JWT token that we are creating.

Best Regards


Here’s a minimal example to log the rewritten path. It needs to be called from the ‘post’ middleware hook.

package main

import (

// LogUrlRewriteTarget logs the final rewrite target
func LogUrlRewriteTarget(rw http.ResponseWriter, r *http.Request) {
  if v := r.Context().Value(ctx.UrlRewriteTarget) ; v != nil {
  } else {
    log.Println("No Rewrite")

func main() {}