diff --git a/pkg/service/bundle/bundleOrder.go b/pkg/service/bundle/bundleOrder.go index 549172d..082e837 100644 --- a/pkg/service/bundle/bundleOrder.go +++ b/pkg/service/bundle/bundleOrder.go @@ -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)