feat: API replicas over HAProxy (3)

This commit is contained in:
2026-11-06 03:26:54 +03:00
parent de2f63b926
commit ec111aadfb
32 changed files with 396 additions and 147 deletions
+10
View File
@@ -17,11 +17,21 @@ import (
const (
headerRequestID = "X-Request-Id"
headerInstanceID = "X-Instance-Id"
headerWWWAuthenticate = "WWW-Authenticate"
bearerChallenge = `Bearer realm="messenger"`
basicChallenge = `Basic realm="messenger", charset="UTF-8"`
)
func InstanceID(id string) func(http.Handler) http.Handler {
return func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set(headerInstanceID, id)
next.ServeHTTP(w, r)
})
}
}
func RequestID(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set(headerRequestID, uuid.New().String())