default to serve host content instead of 404
This commit is contained in:
parent
33bf54d08f
commit
7ef45a39f9
3
http.go
3
http.go
@ -54,8 +54,7 @@ func hostByIP(w http.ResponseWriter, r *http.Request) (*clustersconfig.Host, *cl
|
||||
remoteAddr := r.RemoteAddr
|
||||
|
||||
if *trustXFF {
|
||||
xff := r.Header.Get("X-Forwarded-For")
|
||||
if xff != "" {
|
||||
if xff := r.Header.Get("X-Forwarded-For"); xff != "" {
|
||||
remoteAddr = strings.Split(xff, ",")[0]
|
||||
}
|
||||
}
|
||||
|
7
main.go
7
main.go
@ -33,11 +33,8 @@ func main() {
|
||||
|
||||
go casCleaner()
|
||||
|
||||
http.HandleFunc("/ipxe", serveHostByIP)
|
||||
http.HandleFunc("/kernel", serveHostByIP)
|
||||
http.HandleFunc("/initrd", serveHostByIP)
|
||||
http.HandleFunc("/boot.iso", serveHostByIP)
|
||||
http.HandleFunc("/static-pods", serveHostByIP)
|
||||
// by default, serve a host resource by its IP
|
||||
http.HandleFunc("/", serveHostByIP)
|
||||
|
||||
http.HandleFunc("/hosts", serveHosts)
|
||||
http.HandleFunc("/hosts/", serveHost)
|
||||
|
Loading…
Reference in New Issue
Block a user