From d37edd6a6623640345ba9604335e1f0f7a68a175 Mon Sep 17 00:00:00 2001 From: x1sec <11153104+x1sec@users.noreply.github.com> Date: Thu, 23 Jan 2020 17:02:20 +0900 Subject: [PATCH] fixed content-type issue serving static files --- main.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index 2609da7..ad50d00 100644 --- a/main.go +++ b/main.go @@ -42,6 +42,8 @@ var ( func main() { + fmt.Println("test") + setupLogging() r := mux.NewRouter() @@ -194,14 +196,15 @@ func logHandler(h http.Handler) http.Handler { func staticWrapper(h http.Handler) http.HandlerFunc { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - headers := `Cache-Control : no-cache + headers := `Cache-Control : no-cache Server: Apache + X-Frame-Options: SAMEORIGIN X-XSS-Protection: 1; mode=block - Content-Type: text/html; charset=UTF-8 - Set-Cookie: NSC_TEMP=xyz;Path=/;expires=Wednesday, 09-Nov-1999 23:12:40 GMT;Secure - Set-Cookie: NSC_PERS=xyz;Path=/;expires=Wednesday, 09-Nov-1999 23:12:40 GMT;Secure` + Set-Cookie: NSC_TEMP=xyz;Path=/;expires=Wednesday, 09-Nov-2024 23:12:40 GMT;Secure + Set-Cookie: NSC_PERS=xyz;Path=/;expires=Wednesday, 09-Nov-2024 23:12:40 GMT;Secure` + + //Content-Type: text/html; charset=UTF-8 - //X-Frame-Options: SAMEORIGIN setResponseHeaders(w, headers) @@ -254,6 +257,7 @@ func setupLogging() { cdir, _ := os.Getwd() dir := cdir + "/logs/" + fmt.Println(dir) // create logs dir if _, err := os.Stat(dir); os.IsNotExist(err) { err = os.MkdirAll(dir, 0755)