mirror of
https://github.com/masterking32/MasterHttpRelayVPN.git
synced 2026-05-19 08:04:38 +03:00
Add anti-buffering relay headers and optional randomized query suffixes
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user