Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/404.go
diff options
context:
space:
mode:
Diffstat (limited to '404.go')
-rw-r--r--404.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/404.go b/404.go
index e5f8ec91..3634ddf0 100644
--- a/404.go
+++ b/404.go
@@ -1,5 +1,10 @@
package main
+import (
+ "net/http"
+ "fmt"
+)
+
const predefined404 = `
<!DOCTYPE html>
<html>
@@ -56,3 +61,10 @@ const predefined404 = `
</body>
</html>
`
+
+func serve404(w http.ResponseWriter) {
+ w.Header().Set("Content-Type", "text/plain; charset=utf-8")
+ w.Header().Set("X-Content-Type-Options", "nosniff")
+ w.WriteHeader(http.StatusNotFound)
+ fmt.Fprintln(w, predefined404)
+}