cmd/prober: bypass cache and quota

Arrange for the prober to bypass the quota check.

Also, fix the attempt to bypass the cache, which had both the wrong
header name and the wrong header value.

Change-Id: I9cd7b19903d7ac0b0121e14c7674d553a9daa07a
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/307389
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
diff --git a/cmd/prober/main.go b/cmd/prober/main.go
index 3f305cb..feb7396 100644
--- a/cmd/prober/main.go
+++ b/cmd/prober/main.go
@@ -163,6 +163,7 @@
 
 var (
 	baseURL        string
+	authValue      string
 	client         *http.Client
 	metricExporter *stackdriver.Exporter
 	metricReader   *metricexport.Reader
@@ -206,6 +207,11 @@
 	}
 	log.Infof(ctx, "base URL %s", baseURL)
 
+	authValue = config.GetEnv("GO_DISCOVERY_PROBER_AUTH_VALUE", "")
+	if authValue == "" {
+		log.Warningf(ctx, "missing GO_DISCOVERY_PROBER_AUTH_VALUE; won't bypass cache or quota")
+	}
+
 	cfg, err := config.Init(ctx)
 	if err != nil {
 		log.Fatal(ctx, err)
@@ -333,8 +339,11 @@
 	ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
 	defer cancel()
 	req, err := http.NewRequest(http.MethodGet, url, nil)
-	if p.BypassCache {
-		req.Header.Set("x-go-discovery-bypass-cache", "yes")
+	if authValue != "" {
+		if p.BypassCache {
+			req.Header.Set(config.BypassCacheAuthHeader, authValue)
+		}
+		req.Header.Set(config.BypassQuotaAuthHeader, authValue)
 	}
 	if err != nil {
 		status.Text = fmt.Sprintf("FAILED making request: %v", err)