@@ -255,6 +255,14 @@ func (h *HTTPServer) defaultHandler(w http.ResponseWriter, req *http.Request) {
255
255
}
256
256
257
257
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
258
266
if stringsutil .HasPrefixI (req .URL .Path , "/s/" ) && h .staticHandler != nil {
259
267
if h .options .DynamicResp && len (req .URL .Query ()) > 0 {
260
268
values := req .URL .Query ()
@@ -278,11 +286,7 @@ func (h *HTTPServer) defaultHandler(w http.ResponseWriter, req *http.Request) {
278
286
}
279
287
h .staticHandler .ServeHTTP (w , req )
280
288
} 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 )
286
290
} else if strings .EqualFold (req .URL .Path , "/robots.txt" ) {
287
291
fmt .Fprintf (w , "User-agent: *\n Disallow: / # %s" , reflection )
288
292
} else if stringsutil .HasSuffixI (req .URL .Path , ".json" ) {
0 commit comments