diff --git a/app/server.go b/app/server.go index 4f4bf32..6276bcd 100644 --- a/app/server.go +++ b/app/server.go @@ -179,6 +179,9 @@ func (s *Server) UserInterface() { s.challengeMutex.Unlock() } + // Serve favicon.ico by serving orly.png + s.mux.HandleFunc("/favicon.ico", s.handleFavicon) + // Serve the main login interface (and static assets) or proxy in dev mode s.mux.HandleFunc("/", s.handleLoginInterface) @@ -203,6 +206,26 @@ func (s *Server) UserInterface() { s.mux.HandleFunc("/api/sprocket/config", s.handleSprocketConfig) } +// handleFavicon serves orly.png as favicon.ico +func (s *Server) handleFavicon(w http.ResponseWriter, r *http.Request) { + // In dev mode with proxy configured, forward to dev server + if s.devProxy != nil { + s.devProxy.ServeHTTP(w, r) + return + } + + // Serve orly.png as favicon.ico from embedded web app + w.Header().Set("Content-Type", "image/png") + w.Header().Set("Cache-Control", "public, max-age=86400") // Cache for 1 day + + // Create a request for orly.png and serve it + faviconReq := &http.Request{ + Method: "GET", + URL: &url.URL{Path: "/orly.png"}, + } + ServeEmbeddedWeb(w, faviconReq) +} + // handleLoginInterface serves the main user interface for login func (s *Server) handleLoginInterface(w http.ResponseWriter, r *http.Request) { // In dev mode with proxy configured, forward to dev server