This commit is contained in:
bel
2025-06-19 16:49:06 -06:00
parent e4451923e9
commit 5a0f567da3
3 changed files with 28 additions and 1 deletions

View File

@@ -201,7 +201,22 @@ func pushMeta(r *http.Request, k, v string) {
}
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
s.Pre(s.Proxy)(w, r)
foo := s.Proxy
if strings.Split(r.Host, ".")[0] == "_" {
keys := s.db.Keys(nsRouting)
hostURL := map[string]string{}
for _, key := range keys {
u, _ := s.lookup(key)
if u != nil {
hostURL[key] = u.String()
}
}
json.NewEncoder(w).Encode(map[string]any{
"hostsToURLs": hostURL,
})
return
}
s.Pre(foo)(w, r)
}
type corsResponseWriter struct {