Skip to content

Commit

Permalink
Merge pull request #1132 from FabianKramm/development
Browse files Browse the repository at this point in the history
fix: fixes a small issue in the ui server
  • Loading branch information
FabianKramm committed Jul 16, 2020
2 parents bc73c14 + c242e94 commit c62fc7e
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions pkg/devspace/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"strconv"
"strings"
"sync"
"time"

"github.com/devspace-cloud/devspace/pkg/devspace/config/generated"
"github.com/devspace-cloud/devspace/pkg/devspace/config/loader"
Expand Down Expand Up @@ -174,13 +175,7 @@ func newHandler(configLoader loader.ConfigLoader, config *latest.Config, generat
}
}

indexHtml := filepath.Join(path, "index.html")
stat, err := os.Stat(indexHtml)
if err != nil {
return nil, err
}

out, err := ioutil.ReadFile(indexHtml)
out, err := ioutil.ReadFile(filepath.Join(path, "index.html"))
if err != nil {
return nil, err
}
Expand All @@ -193,7 +188,7 @@ func newHandler(configLoader loader.ConfigLoader, config *latest.Config, generat

newOut := strings.Replace(string(out), "###TOKEN###", token, -1)
handler.mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
http.ServeContent(w, r, "index.html", stat.ModTime(), bytes.NewReader([]byte(newOut)))
http.ServeContent(w, r, "index.html", time.Now(), bytes.NewReader([]byte(newOut)))
})
handler.mux.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir(filepath.Join(path, "static")))))
handler.mux.HandleFunc("/api/version", handler.version)
Expand Down Expand Up @@ -228,7 +223,7 @@ func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
token := r.URL.Query().Get("token")
if token != h.token {
w.WriteHeader(http.StatusUnauthorized)
h.log.Infof("%s: unauthorized access from %s", r.URL.Path, r.RemoteAddr)
// h.log.Infof("%s: unauthorized access from %s", r.URL.Path, r.RemoteAddr)
return
}
}
Expand Down

0 comments on commit c62fc7e

Please # to comment.