repos / pico

pico services mono repo
git clone https://github.com/picosh/pico.git

commit
663da98
parent
7deac4f
author
Eric Bower
date
2025-06-15 13:47:01 -0400 EDT
fix(pgs): cdn check endpoint
1 files changed,  +11, -0
M cmd/pgs/cdn/main.go
+11, -0
 1@@ -14,6 +14,7 @@ import (
 2 	"github.com/picosh/pico/pkg/apps/pgs"
 3 	"github.com/picosh/pico/pkg/cache"
 4 	"github.com/picosh/pico/pkg/shared"
 5+	"github.com/prometheus/client_golang/prometheus/promhttp"
 6 )
 7 
 8 func main() {
 9@@ -52,6 +53,16 @@ type cachedHttp struct {
10 func (c *cachedHttp) ServeHTTP(writer http.ResponseWriter, req *http.Request) {
11 	_ = c.handler.ServeHTTP(writer, req, func(w http.ResponseWriter, r *http.Request) error {
12 		url, _ := url.Parse(fullURL(r))
13+
14+		if req.URL.Path == "/_metrics" {
15+			promhttp.Handler().ServeHTTP(writer, req)
16+			return nil
17+		}
18+
19+		if req.URL.Path == "/check" {
20+			url, _ = url.Parse("https://pgs.sh/check?" + r.URL.RawQuery)
21+		}
22+
23 		c.routes.Cfg.Logger.Info("proxying request to ash.pgs.sh", "url", url.String())
24 		defaultTransport := http.DefaultTransport.(*http.Transport)
25 		newTransport := defaultTransport.Clone()