diff options
| author | Konstantin Lebedev <9497591+kmlebedev@users.noreply.github.com> | 2025-11-14 06:25:47 +0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-13 17:25:47 -0800 |
| commit | 4477edbcc4cd3adb43b3c42f56010388a4373c20 (patch) | |
| tree | 21c10233553f0887f65af33b8cbc019d237361e0 /weed/server/volume_server_handlers.go | |
| parent | 0e69f7c91606b42fe2e1e55d65d24659e546bf33 (diff) | |
| download | seaweedfs-4477edbcc4cd3adb43b3c42f56010388a4373c20.tar.xz seaweedfs-4477edbcc4cd3adb43b3c42f56010388a4373c20.zip | |
fix: pass proxied query param (#7477)
* fix: pass proxied query param
* fix: use math/rand/v2
* Shuffle condition
---------
Co-authored-by: chrislu <chris.lu@gmail.com>
Diffstat (limited to 'weed/server/volume_server_handlers.go')
| -rw-r--r-- | weed/server/volume_server_handlers.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/weed/server/volume_server_handlers.go b/weed/server/volume_server_handlers.go index a42732062..cf22adf34 100644 --- a/weed/server/volume_server_handlers.go +++ b/weed/server/volume_server_handlers.go @@ -75,6 +75,10 @@ func (vs *VolumeServer) checkDownloadLimit(w http.ResponseWriter, r *http.Reques // - true: Request was handled (either proxied successfully or failed with error response) // - false: No proxy available (volume has no replicas or request already proxied) func (vs *VolumeServer) tryProxyToReplica(w http.ResponseWriter, r *http.Request) bool { + if r.URL.Query().Get(reqIsProxied) == "true" { + return false // already proxied + } + vid, _, _, _, _ := parseURLPath(r.URL.Path) volumeId, err := needle.NewVolumeId(vid) if err != nil { @@ -84,7 +88,7 @@ func (vs *VolumeServer) tryProxyToReplica(w http.ResponseWriter, r *http.Request } volume := vs.store.GetVolume(volumeId) - if volume != nil && volume.ReplicaPlacement != nil && volume.ReplicaPlacement.HasReplication() && r.URL.Query().Get(reqIsProxied) != "true" { + if volume != nil && volume.ReplicaPlacement != nil && volume.ReplicaPlacement.HasReplication() { vs.proxyReqToTargetServer(w, r) return true // handled by proxy } |
