Skip to content

Commit 0f41e36

Browse files
committed
Fix HTTP file server
1 parent 95e346c commit 0f41e36

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pkg/http/server.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@ func NewServer(addr string, path, extra string) *Server {
1919
}
2020

2121
func (server *Server) Serve() error {
22-
http.Handle("/ipxe", http.FileServer(http.Dir(server.Scripts)))
22+
mux := http.NewServeMux()
23+
mux.Handle("/ipxe/", http.StripPrefix("/ipxe", http.FileServer(http.Dir(server.Scripts))))
2324

2425
if server.Extra != "" {
25-
http.Handle("/extra", http.FileServer(http.Dir(server.Extra)))
26+
mux.Handle("/extra/", http.StripPrefix("/extra", http.FileServer(http.Dir(server.Extra))))
2627
}
2728

28-
return http.ListenAndServe(server.Addr, nil)
29+
return http.ListenAndServe(server.Addr, mux)
2930
}

0 commit comments

Comments
 (0)