Skip to content

Commit

Permalink
fixed content-type issue serving static files
Browse files Browse the repository at this point in the history
  • Loading branch information
haxrob committed Jan 23, 2020
1 parent cbd7b00 commit d37edd6
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ var (

func main() {

fmt.Println("test")

setupLogging()

r := mux.NewRouter()
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit d37edd6

Please sign in to comment.