I am writing a api server for upload and serve video and image by go-gin framework. I have uploaded my video to another host, and it worked
router := gin.Default()
//config := cors.DefaultConfig()
//config.AllowAllOrigins = true
routerConfig := cors.Config{
AllowAllOrigins: true,
AllowMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"},
AllowHeaders: []string{"X-Requested-With", "Authorization", "Origin", "Content-Length", "Content-Type"},
AllowCredentials: false,
MaxAge: 12 * time.Hour,
}
router.Use(cors.New(routerConfig))
router.StaticFS("/public", http.Dir("static"))
err := router.Run(":5000")
if err != nil {
panic(err)
}
When I try to access http://localhost:5000/public/{image_url}.png
by chromium. It loads to browser. But when I access http://localhost:5000/public/{video_url}.mp4
by chromium, it can't load anything from browser (It can't receive)
Can someone explain for me what I am doing wrong?
Update:
Maybe I missed this content:
Here are my 2 http packages when I call a GET
request