修改
This commit is contained in:
parent
30a6b5cb7f
commit
7fc9c57be7
@ -408,11 +408,24 @@ func ExportOrderInfo(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var httpType string
|
var httpType string = "http" // Default to http
|
||||||
fmt.Printf("c.Request.RequestURI %+v\n", c.Request.RequestURI)
|
|
||||||
fmt.Printf("c.Request.URL %+v\n", c.Request.URL)
|
// Safely check if Origin exists in c.Keys
|
||||||
fmt.Printf("c.Request.Origin %+v\n", c.Keys["Origin"])
|
if origin, exists := c.Keys["Origin"]; exists && origin != nil {
|
||||||
httpType = strings.Split(c.Keys["Origin"].(string), ":")[0]
|
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(httpType)
|
||||||
fmt.Println(filePath)
|
fmt.Println(filePath)
|
||||||
|
Loading…
Reference in New Issue
Block a user