Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Bug] infinite redirect with RedirectFixedPath #4034

@ALX99

Description

@ALX99

Description

Enabling RedirectFixedPath sometimes leads to infinite redirects

How to reproduce

package main

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

func main() {
	r := gin.Default()

	r.GET("/あ", func(c *gin.Context) {
		c.JSON(200, gin.H{})
	})

	r.UnescapePathValues = false
	r.UseRawPath = true
	r.RedirectFixedPath = true
	r.Run(":8181")
}

Expectations

$ curl 'localhost:8181/%E3%81%82' -L
{}
$ curl 'localhost:8181/%e3%81%82' -L
{}
$ curl 'localhost:8181/あ' -L
{}

Actual result

$ curl 'localhost:8181/%E3%81%82' -L
{}
$ curl 'localhost:8181/%e3%81%82' -L
curl: (47) Maximum (50) redirects followed
$ curl 'localhost:8181/あ' -L
curl: (47) Maximum (50) redirects followed

Environment

go version: 1.23.0
gin version (or commit ref): v1.10.0
operating system: macOS Sequoia

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions