Browse Source

Index.html load priority

Vova Tkach 6 years ago
parent
commit
016f374330
1 changed files with 14 additions and 0 deletions
  1. 14 0
      engine/wrapper/static.go

+ 14 - 0
engine/wrapper/static.go

@@ -78,6 +78,20 @@ func (e *Wrapper) staticFile() bool {
 			http.ServeFile(*e.W, e.R, e.DirVhostHome+"/htdocs"+file)
 			http.ServeFile(*e.W, e.R, e.DirVhostHome+"/htdocs"+file)
 			return true
 			return true
 		}
 		}
+	} else {
+		f, err := os.Open(e.DirVhostHome + "/htdocs/index.html")
+		if err == nil {
+			defer f.Close()
+			st, err := os.Stat(e.DirVhostHome + "/htdocs/index.html")
+			if err != nil {
+				return false
+			}
+			if st.Mode().IsDir() {
+				return false
+			}
+			http.ServeFile(*e.W, e.R, e.DirVhostHome+"/htdocs/index.html")
+			return true
+		}
 	}
 	}
 	return false
 	return false
 }
 }