Add anti-buffering relay headers and optional randomized query suffixes

This commit is contained in:
Amin.MasterkinG
2026-04-21 15:28:09 +03:30
parent bf5c0ef06e
commit 74ff27ac78
7 changed files with 172 additions and 1 deletions
+9
View File
@@ -107,6 +107,8 @@ func (s *Server) Run(ctx context.Context) error {
}
func (s *Server) handleRelay(w http.ResponseWriter, r *http.Request) {
applyRelayResponseHeaders(w.Header())
if r.Method != http.MethodPost {
http.Error(w, "method not allowed", http.StatusMethodNotAllowed)
return
@@ -167,6 +169,13 @@ func (s *Server) handleRelay(w http.ResponseWriter, r *http.Request) {
_, _ = w.Write(encrypted)
}
func applyRelayResponseHeaders(header http.Header) {
header.Set("Cache-Control", "no-store, no-cache, must-revalidate")
header.Set("Pragma", "no-cache")
header.Set("Expires", "0")
header.Set("X-Accel-Buffering", "no")
}
func (s *Server) processBatch(batch protocol.Batch) (protocol.Batch, error) {
session := s.getOrCreateSession(batch.ClientSessionKey)
now := time.Now()