From 7ae1a29932463049aef332d176281e2f611272e0 Mon Sep 17 00:00:00 2001 From: Gianni Carafa Date: Thu, 2 Nov 2023 22:59:07 +0100 Subject: [PATCH] add loggin switch --- README.md | 1 + handlers/proxy.go | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 49cfc20..772abdd 100644 --- a/README.md +++ b/README.md @@ -72,3 +72,4 @@ http://localhost:8080/raw/https://www.google.com | `USER_AGENT` | User agent to emulate | `Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)` | | `X_FORWARDED_FOR` | IP Forwarder address | `66.249.66.1` | | `USERPASS` | Enables Basic Auth, format `admin:123456` | | +| `LOG_URLS` | Log fetched URL's | `true` | diff --git a/handlers/proxy.go b/handlers/proxy.go index d6559b9..3816437 100644 --- a/handlers/proxy.go +++ b/handlers/proxy.go @@ -41,13 +41,16 @@ func fetchSite(urlpath string, queries map[string]string) (string, *http.Request } } urlQuery = strings.TrimSuffix(urlQuery, "&") + urlQuery = strings.TrimSuffix(urlQuery, "?") u, err := url.Parse(urlpath) if err != nil { return "", nil, nil, err } - log.Println(u.String() + urlQuery) + if os.Getenv("LOG_URLS ") == "" || os.Getenv("NOLOGS") == "true" { + log.Println(u.String() + urlQuery) + } // Fetch the site client := &http.Client{}