0
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2024-12-23 22:27:38 -05:00

Merge pull request #14 from abiosoft/master

Fix for Issue 13: Trouble running in Docker containers (or binding to 0.0.0.0)
This commit is contained in:
Matt Holt 2015-04-28 20:25:15 -06:00
commit 0f332bd9fb

View file

@ -161,6 +161,13 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
host = r.Host // oh well
}
// Try the host as given, or try falling back to 0.0.0.0 (wildcard)
if _, ok := s.vhosts[host]; !ok {
if _, ok2 := s.vhosts["0.0.0.0"]; ok2 {
host = "0.0.0.0"
}
}
if vh, ok := s.vhosts[host]; ok {
w.Header().Set("Server", "Caddy")