Set server version in correct place

This commit is contained in:
Torjus Håkestad 2021-06-18 14:56:00 +02:00
parent baa3990d38
commit 0cce8aecc6
2 changed files with 2 additions and 2 deletions

View File

@ -5,7 +5,7 @@ import (
"runtime"
)
var Version = "v0.1.4"
var Version = "v0.1.5"
var Build string
func FullVersion() string {

View File

@ -84,6 +84,7 @@ func NewServer(cfg config.FrontendConfig, hs *honeypot.HoneypotServer, store sto
r.Use(middleware.RealIP)
r.Use(middleware.RequestID)
r.Use(s.LoggingMiddleware)
r.Use(middleware.SetHeader("Server", apiary.FullVersion()))
r.Route("/", func(r chi.Router) {
r.Get("/*", s.IndexHandler("web/vue-frontend/dist"))
@ -152,7 +153,6 @@ func (s *Server) HandlerAttemptStream(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Cache-Control", "no-cache")
w.Header().Set("Connection", "keep-alive")
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Server", apiary.FullVersion())
id, ch := s.addAttemptListener()
defer s.closeAttemptListener(id)
w.WriteHeader(http.StatusOK)