Expose metadata when running on bunny.net magic containers.

This commit is contained in:
Catherine
2025-09-17 14:55:50 +00:00
parent ef7aea6a38
commit 705685e918
+9
View File
@@ -27,6 +27,15 @@ func getPage(w http.ResponseWriter, r *http.Request) error {
host := GetHost(r)
if _, onBunnyNet := os.LookupEnv("BUNNYNET_MC_APPID"); onBunnyNet {
w.Header().Set("X-Bunnynet-MC", fmt.Sprintf(
"%s, %s, %s",
os.Getenv("BUNNYNET_MC_REGION"),
os.Getenv("BUNNYNET_MC_ZONE"),
os.Getenv("BUNNYNET_MC_PODID"),
))
}
// allow JavaScript code to access responses (including errors) even across origins
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Access-Control-Max-Age", "86400")