I have been struggling with this for a bit. How do I return, from RiceBox, favicon.ico from a static directory?
Here's the code I have, including relevant parts:
mux := mux.NewServeMux()
StaticBox := rice.MustFindBox("static")
StaticFileServer := http.StripPrefix("/static/", http.FileServer(StaticBox.HTTPBox()))
mux.Handle("/static/", StaticFileServer)
mux.HandleFunc("/", Home)
Note: favicon.ico lives inside the static directory among other assets like, js/, css/, etc.
404 when fetching it:
$ wget http://localhost:9000/favicon.ico
--2018-03-02 09:40:08-- http://localhost:9000/favicon.ico
Resolving localhost... ::1, 127.0.0.1
Connecting to localhost|127.0.0.1|:9000... connected.
HTTP request sent, awaiting response... 404 Not Found
2018-03-02 09:40:08 ERROR 404: Not Found.