Gin response 404 with latest version (1.6.3) on Haproxy

We are using Haproxy on our server. Our gin version was v1.4.0 end everyting was working great. However when I updated gin v.1.6.3, the service always responded with 404 in all routes. By the way, when I try to access directly, the responses are OK. So the problem is about Haproxy and gin v.1.6.3 I think.

Our Haproxy configuration is:

backend user-service
   reqrep ^([^\ ]*)\ /user(.*)     \1\ /\2
   balance roundrobin
   server manager01 127.0.0.1:8080

My dummy test service which responds 404 is this:

package main

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

func main() {
	router := gin.Default()
	router.POST("/test", func(c *gin.Context) {
		name := c.Param("name")
		c.String(http.StatusOK, "Hello %%s", name)
	})
	router.Run(":8080")
}

Should it be a bug or something in this version?

Environment

  • go version: 1.4.2
  • gin version 1.6.3
  • operating system: Ubuntu 18.04

1 possible answer(s) on “Gin response 404 with latest version (1.6.3) on Haproxy