remove unused scheme assignment in URL redirection logic
All checks were successful
Build and Push Container Image, Deploy to Host / build-and-push-and-deploy (push) Successful in 36s
All checks were successful
Build and Push Container Image, Deploy to Host / build-and-push-and-deploy (push) Successful in 36s
This commit is contained in:
2
main.go
2
main.go
@ -22,7 +22,6 @@ func main() {
|
|||||||
newHost := strings.TrimSuffix(host, OldDomain) + NewDomain
|
newHost := strings.TrimSuffix(host, OldDomain) + NewDomain
|
||||||
scheme := "https"
|
scheme := "https"
|
||||||
if proto := c.Request.Header.Get("X-Forwarded-Proto"); len(proto) > 0 {
|
if proto := c.Request.Header.Get("X-Forwarded-Proto"); len(proto) > 0 {
|
||||||
scheme = string(proto)
|
|
||||||
} else if forwarded := c.Request.Header.Get("Forwarded"); len(forwarded) > 0 {
|
} else if forwarded := c.Request.Header.Get("Forwarded"); len(forwarded) > 0 {
|
||||||
// Forwarded: proto=https;host=xxx
|
// Forwarded: proto=https;host=xxx
|
||||||
for _, part := range strings.Split(string(forwarded), ";") {
|
for _, part := range strings.Split(string(forwarded), ";") {
|
||||||
@ -40,7 +39,6 @@ func main() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
h.GET("/*any", func(ctx context.Context, c *app.RequestContext) {
|
h.GET("/*any", func(ctx context.Context, c *app.RequestContext) {
|
||||||
c.JSON(200, map[string]interface{}{"message": "pong"})
|
c.JSON(200, map[string]interface{}{"message": "pong"})
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user