repos / pico

pico services - prose.sh, pastes.sh, imgs.sh, feeds.sh, pgs.sh
git clone https://github.com/picosh/pico.git

commit
bc4e349
parent
121c015
author
Eric Bower
date
2024-03-09 22:28:11 +0000 UTC
chore(pgs): caddy
1 files changed,  +51, -38
M caddy/Caddyfile.pgs
+51, -38
  1@@ -9,6 +9,24 @@
  2 	}
  3 }
  4 
  5+(cors) {
  6+	@cors_preflight method OPTIONS
  7+	@cors header Origin {$APP_DOMAIN}
  8+
  9+	handle @cors_preflight {
 10+		header Access-Control-Allow-Origin "*"
 11+		header Access-Control-Allow-Methods "GET, POST, PUT, PATCH, DELETE"
 12+		header Access-Control-Allow-Headers "Content-Type"
 13+		header Access-Control-Max-Age "3600"
 14+		respond "" 204
 15+	}
 16+
 17+	handle @cors {
 18+		header Access-Control-Allow-Origin "*"
 19+		header Access-Control-Expose-Headers "Link"
 20+	}
 21+}
 22+
 23 *.{$APP_DOMAIN}, {$APP_DOMAIN} {
 24 	reverse_proxy web:3000
 25 	tls {$APP_EMAIL} {
 26@@ -36,12 +54,6 @@
 27 		Content-Security-Policy "default-src 'self'; img-src * 'unsafe-inline'; style-src * 'unsafe-inline'"
 28 
 29 		X-XSS-Protection "1; mode=block"
 30-
 31-    # CORS
 32-    header Access-Control-Allow-Origin "*"
 33-    header Access-Control-Allow-Methods "GET, POST, PUT, PATCH, DELETE"
 34-    header Access-Control-Allow-Headers "*"
 35-    header Access-Control-Max-Age "3600"
 36 	}
 37 
 38 	@caddymetrics {
 39@@ -65,41 +77,42 @@
 40 }
 41 
 42 monitoring.{$MONITORING_APP_DOMAIN}, prometheus.{$MONITORING_APP_DOMAIN}, grafana.{$MONITORING_APP_DOMAIN} {
 43-       @grafana {
 44-               host grafana.{$MONITORING_APP_DOMAIN}
 45-       }
 46-
 47-       @prometheus {
 48-               host prometheus.{$MONITORING_APP_DOMAIN}
 49-       }
 50-
 51-       tls {$MONITORING_APP_EMAIL} {
 52-               dns cloudflare {$CF_API_TOKEN}
 53-               resolvers 1.1.1.1
 54-       }
 55-
 56-       encode zstd gzip
 57-
 58-       reverse_proxy @grafana grafana:3000
 59-
 60-       basicauth @prometheus {
 61-               eric JDJhJDE0JDdPOXhoNUdhSmNVNDl6UWpmeTE0cWVkLjRwcUNJUnc0dVQ4MTZNSmVaNjA1TlptaVZYY1hh
 62-               antonio JDJhJDE0JHI5dkVtMW0vcGxIb011OG4vME5HOU91c3U2VjM2QTZiWVpUeXdSbEg3VUtNZVdhN3BRazFH
 63-               bot JDJhJDE0JFVsRlNHSDlJbFhDeUd0NldRR2JkcGVFYUJtWGluTHZDVlc5L3QwNWNwWUMuODRlcXZNZHpT
 64-       }
 65-       reverse_proxy @prometheus prometheus:9090
 66-
 67-       @caddymetrics {
 68-               host monitoring.{$MONITORING_APP_DOMAIN}
 69-               path /_caddy/metrics
 70-       }
 71-
 72-       metrics @caddymetrics {
 73-               disable_openmetrics
 74-       }
 75+	@grafana {
 76+		host grafana.{$MONITORING_APP_DOMAIN}
 77+	}
 78+
 79+	@prometheus {
 80+		host prometheus.{$MONITORING_APP_DOMAIN}
 81+	}
 82+
 83+	tls {$MONITORING_APP_EMAIL} {
 84+		dns cloudflare {$CF_API_TOKEN}
 85+		resolvers 1.1.1.1
 86+	}
 87+
 88+	encode zstd gzip
 89+
 90+	reverse_proxy @grafana grafana:3000
 91+
 92+	basicauth @prometheus {
 93+		eric JDJhJDE0JDdPOXhoNUdhSmNVNDl6UWpmeTE0cWVkLjRwcUNJUnc0dVQ4MTZNSmVaNjA1TlptaVZYY1hh
 94+		antonio JDJhJDE0JHI5dkVtMW0vcGxIb011OG4vME5HOU91c3U2VjM2QTZiWVpUeXdSbEg3VUtNZVdhN3BRazFH
 95+		bot JDJhJDE0JFVsRlNHSDlJbFhDeUd0NldRR2JkcGVFYUJtWGluTHZDVlc5L3QwNWNwWUMuODRlcXZNZHpT
 96+	}
 97+	reverse_proxy @prometheus prometheus:9090
 98+
 99+	@caddymetrics {
100+		host monitoring.{$MONITORING_APP_DOMAIN}
101+		path /_caddy/metrics
102+	}
103+
104+	metrics @caddymetrics {
105+		disable_openmetrics
106+	}
107 }
108 
109 :443 {
110+	import cors
111 	reverse_proxy web:3000
112 	tls {$APP_EMAIL} {
113 		on_demand