Skip to content

Commit 8455d2b

Browse files
committed
fix -hiresponse
1 parent fded0e1 commit 8455d2b

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

pkg/server/http_server.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,14 @@ func (h *HTTPServer) defaultHandler(w http.ResponseWriter, req *http.Request) {
255255
}
256256

257257
reflection := h.options.URLReflection(req.Host)
258+
259+
// If custom index is defined, always return it regardless of path
260+
if h.customBanner != "" {
261+
fmt.Fprint(w, strings.ReplaceAll(h.customBanner, "{DOMAIN}", domain))
262+
return
263+
}
264+
265+
// Handle other cases if no custom index is defined
258266
if stringsutil.HasPrefixI(req.URL.Path, "/s/") && h.staticHandler != nil {
259267
if h.options.DynamicResp && len(req.URL.Query()) > 0 {
260268
values := req.URL.Query()
@@ -278,11 +286,7 @@ func (h *HTTPServer) defaultHandler(w http.ResponseWriter, req *http.Request) {
278286
}
279287
h.staticHandler.ServeHTTP(w, req)
280288
} else if req.URL.Path == "/" && reflection == "" {
281-
if h.customBanner != "" {
282-
fmt.Fprint(w, strings.ReplaceAll(h.customBanner, "{DOMAIN}", domain))
283-
} else {
284-
fmt.Fprintf(w, banner, domain)
285-
}
289+
fmt.Fprintf(w, banner, domain)
286290
} else if strings.EqualFold(req.URL.Path, "/robots.txt") {
287291
fmt.Fprintf(w, "User-agent: *\nDisallow: / # %s", reflection)
288292
} else if stringsutil.HasSuffixI(req.URL.Path, ".json") {

0 commit comments

Comments
 (0)