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
|
remoteAddr := r.RemoteAddr
|
||||||
|
|
||||||
if *trustXFF {
|
if *trustXFF {
|
||||||
xff := r.Header.Get("X-Forwarded-For")
|
if xff := r.Header.Get("X-Forwarded-For"); xff != "" {
|
||||||
if xff != "" {
|
|
||||||
remoteAddr = strings.Split(xff, ",")[0]
|
remoteAddr = strings.Split(xff, ",")[0]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
7
main.go
7
main.go
@ -33,11 +33,8 @@ func main() {
|
|||||||
|
|
||||||
go casCleaner()
|
go casCleaner()
|
||||||
|
|
||||||
http.HandleFunc("/ipxe", serveHostByIP)
|
// by default, serve a host resource by its IP
|
||||||
http.HandleFunc("/kernel", serveHostByIP)
|
http.HandleFunc("/", serveHostByIP)
|
||||||
http.HandleFunc("/initrd", serveHostByIP)
|
|
||||||
http.HandleFunc("/boot.iso", serveHostByIP)
|
|
||||||
http.HandleFunc("/static-pods", serveHostByIP)
|
|
||||||
|
|
||||||
http.HandleFunc("/hosts", serveHosts)
|
http.HandleFunc("/hosts", serveHosts)
|
||||||
http.HandleFunc("/hosts/", serveHost)
|
http.HandleFunc("/hosts/", serveHost)
|
||||||
|
Loading…
Reference in New Issue
Block a user