File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -423,9 +423,18 @@ func (pm *ProxyManager) proxyToUpstream(c *gin.Context) {
423423 // Check if this is exactly a model name with no additional path
424424 // and doesn't end with a trailing slash
425425 if remainingPath == "/" && ! strings .HasSuffix (upstreamPath , "/" ) {
426- // Redirect to add trailing slash
426+ // Build new URL with query parameters preserved
427427 newPath := "/upstream/" + searchModelName + "/"
428- c .Redirect (http .StatusMovedPermanently , newPath )
428+ if c .Request .URL .RawQuery != "" {
429+ newPath += "?" + c .Request .URL .RawQuery
430+ }
431+
432+ // Use 308 for non-GET/HEAD requests to preserve method
433+ if c .Request .Method == http .MethodGet || c .Request .Method == http .MethodHead {
434+ c .Redirect (http .StatusMovedPermanently , newPath )
435+ } else {
436+ c .Redirect (http .StatusPermanentRedirect , newPath )
437+ }
429438 return
430439 }
431440 break
You can’t perform that action at this time.
0 commit comments