From 4b41ba6ff4ee10b6bd67135fa3e33b38e5e55f1f Mon Sep 17 00:00:00 2001 From: Bel LaPointe <153096461+breel-render@users.noreply.github.com> Date: Wed, 9 Sep 2026 07:38:20 -0700 Subject: [PATCH] if DEBUG then extra log --- config.go | 2 ++ main.go | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/config.go b/config.go index 784cd9a..f436e65 100644 --- a/config.go +++ b/config.go @@ -9,6 +9,8 @@ import ( "gopkg.in/yaml.v2" ) +var debug = os.Getenv("DEBUG") != "" + type ( Config struct { Cert Cert diff --git a/main.go b/main.go index decde89..16d9837 100644 --- a/main.go +++ b/main.go @@ -107,6 +107,9 @@ func (c Config) serveHTTPProxy(w http.ResponseWriter, r *http.Request, endpoint u3 := *u u3.Path = "/" r2.Header.Set("Origin", u3.String()) + if debug { + log.Printf("r2.Header[Origin] = %q", r2.Header.Get("Origin")) + } return nil }) if err != nil { @@ -177,6 +180,9 @@ func (c Config) endpoint(r *http.Request) Endpoint { key := c.key(r) domain := strings.Split(strings.TrimPrefix(r.Host, key), ":")[0] m, ok := c.Domains[domain] + if debug { + log.Printf("[%s][%s] = %+v", key, domain, m[key]) + } if !ok { return Endpoint{} }