dimanche 21 novembre 2021

golang gin redirect loop

gin suddenly throws a "gin debug" that says it redirected a url, but the new url is just the same.

i wrote the code like this:

r := gin.Default() 
r.GET("/profile/get_avatar/:user_id", getAvatar)

and the logs are:

[GIN-debug] redirecting request 301: /profile/get_avatar/defaultID.jpg --> /profile/get_avatar/defaultID.jpg
[GIN] 2021/11/21 - 23:27:03 | 301 |            0s |       127.0.0.1 | GET      "/profile/get_avatar/defaultID.jpg"
[GIN-debug] redirecting request 301: /profile/get_avatar/defaultID.jpg --> /profile/get_avatar/defaultID.jpg
[GIN] 2021/11/21 - 23:27:03 | 301 |            0s |       127.0.0.1 | GET      "/profile/get_avatar/defaultID.jpg"
[GIN-debug] redirecting request 301: /profile/get_avatar/defaultID.jpg --> /profile/get_avatar/defaultID.jpg
[GIN] 2021/11/21 - 23:27:03 | 301 |       991.2µs |       127.0.0.1 | GET      "/profile/get_avatar/defaultID.jpg"
[GIN-debug] redirecting request 301: /profile/get_avatar/defaultID.jpg --> /profile/get_avatar/defaultID.jpg
[GIN] 2021/11/21 - 23:27:03 | 301 |            0s |       127.0.0.1 | GET      "/profile/get_avatar/defaultID.jpg"
[GIN-debug] redirecting request 301: /profile/get_avatar/defaultID.jpg --> /profile/get_avatar/defaultID.jpg
[GIN] 2021/11/21 - 23:27:03 | 301 |       999.8µs |       127.0.0.1 | GET      "/profile/get_avatar/defaultID.jpg"

does anybody know what happens here?




Aucun commentaire:

Enregistrer un commentaire