I have a go program running in a docker container. I have set it up so that when you go to localhost:8080 (the port that the program is running on) it serves up the documentation files which were created using swagger-ui. The index.html file shows up, and in that file it imports one css file, one png file, and two javascript files. The png gets imported correctly (it is only 628 bytes); however, the other three files don't get served correctly (they are all a few hundred KB). I believe the problem is that they are too big as if I delete part of the files to get them under 32 KB, they are served correctly. I am not sure how to increase this file limit, though.
I've looked through all of my code and a fair amount of the http package to see where this hard limit might be set, but can't find it anywhere.
Here's the code that creates my fileserver and serves the files
fs := http.FileServer(http.Dir(docRoot)) // docRoot is a config variable
for _, f := range files {
path := fmt.Sprintf("/%s", f.Name())
serveFile := func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path == path || r.URL.Path == "/index.html" && path == "/" {
fs.ServeHTTP(w, r)
} else {
origHandler.ServeHTTP(w, r)
}
}
docHandler.HandleFunc(path, serveFile)
}
I would think that there would be some Handler.SetMaxSize() or maybe ResponseWriter.SetMaxSize() method, but I can't find anything like this in the http package. Does anyone know how to increase this hard limit or where it might be set?