• With issues:
  • Use the search tool before opening a new issue.
  • Please provide source code and commit sha if you found a bug.
  • Review existing issues and provide feedback or react to them.

Description

I have a middleware that will call c.Abort() and return, I want to modify the status code and redirect to a certain page in the function that calls this middleware.

How to reproduce

package main

import (
    "github.com/gin-gonic/gin"
)

func middle()gin.HandlerFunc {
  return func(c *gin.Context) {
    c.JSON(200,"data")
    c.Abort()
    return
  }
}

func updateStatusHandler(c *gin.context){
    middle(c)
    if c.IsAborted() {
          // update code and redirct to a url
         c.Redirect(http.StatusFound, pageUrl)
          return
  }
}

Expectations

Actual result

Environment

  • go version: go 1.18
  • gin version (or commit ref): gin 1.7.7
  • operating system:

Comment From: uzqw

Where is your reverse proxy please?