Skip to content

Commit e7dea09

Browse files
committed
fix: 修复上游地址拼接路径问题
1 parent 373aece commit e7dea09

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

internal/channel/base_channel.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,10 @@ func (b *BaseChannel) BuildUpstreamURL(originalURL *url.URL, group *models.Group
7575

7676
finalURL := *base
7777
proxyPrefix := "/proxy/" + group.Name
78-
if strings.HasPrefix(originalURL.Path, proxyPrefix) {
79-
finalURL.Path = strings.TrimPrefix(originalURL.Path, proxyPrefix)
80-
} else {
81-
finalURL.Path = originalURL.Path
82-
}
78+
requestPath := originalURL.Path
79+
requestPath = strings.TrimPrefix(requestPath, proxyPrefix)
80+
81+
finalURL.Path = strings.TrimRight(finalURL.Path, "/") + requestPath
8382

8483
finalURL.RawQuery = originalURL.RawQuery
8584

0 commit comments

Comments
 (0)