Add Ubuntu deployment: scripts, SSL, systemd and setup.sh

This commit is contained in:
shop
2026-06-25 16:47:01 +03:00
parent ee5688f722
commit 8a7f79a70c
19 changed files with 387 additions and 58 deletions
+19
View File
@@ -0,0 +1,19 @@
package middleware
import (
"net/http"
"strings"
)
// TrustProxy восстанавливает схему HTTPS за Caddy/nginx.
func TrustProxy(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if proto := r.Header.Get("X-Forwarded-Proto"); strings.EqualFold(proto, "https") {
r.URL.Scheme = "https"
}
if host := r.Header.Get("X-Forwarded-Host"); host != "" {
r.Host = host
}
next.ServeHTTP(w, r)
})
}