修改
This commit is contained in:
parent
30a6b5cb7f
commit
7fc9c57be7
@ -408,11 +408,24 @@ func ExportOrderInfo(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
var httpType string
|
||||
fmt.Printf("c.Request.RequestURI %+v\n", c.Request.RequestURI)
|
||||
fmt.Printf("c.Request.URL %+v\n", c.Request.URL)
|
||||
fmt.Printf("c.Request.Origin %+v\n", c.Keys["Origin"])
|
||||
httpType = strings.Split(c.Keys["Origin"].(string), ":")[0]
|
||||
var httpType string = "http" // Default to http
|
||||
|
||||
// Safely check if Origin exists in c.Keys
|
||||
if origin, exists := c.Keys["Origin"]; exists && origin != nil {
|
||||
originStr, ok := origin.(string)
|
||||
if ok && originStr != "" {
|
||||
fmt.Printf("c.Request.Origin %+v\n", originStr)
|
||||
parts := strings.Split(originStr, ":")
|
||||
if len(parts) > 0 {
|
||||
httpType = parts[0]
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Fallback: Check if the request was made over TLS
|
||||
if c.Request.TLS != nil || c.Request.Header.Get("X-Forwarded-Proto") == "https" {
|
||||
httpType = "https"
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Println(httpType)
|
||||
fmt.Println(filePath)
|
||||
|
Loading…
Reference in New Issue
Block a user