From b949939816f8e13f29fe562ae90785667683f0b0 Mon Sep 17 00:00:00 2001 From: Liujian <824010343@qq.com> Date: Fri, 8 Aug 2025 12:04:40 +0800 Subject: [PATCH 1/2] Fix: The issue where the upstream forwarding header is not effective --- module/publish/iml.go | 64 +++++++++++++++++++++++++------------------ 1 file changed, 38 insertions(+), 26 deletions(-) diff --git a/module/publish/iml.go b/module/publish/iml.go index f4a066f5..a0df0cb7 100644 --- a/module/publish/iml.go +++ b/module/publish/iml.go @@ -185,6 +185,41 @@ func (i *imlPublishModule) getProjectRelease(ctx context.Context, projectID stri Id: projectID, Version: version, } + upstreamProxyHeaders := make([]*gateway.ProxyHeader, 0) + var upstreamRelease *gateway.UpstreamRelease + if len(upstreamCommitIds) > 0 { + upstreamCommits, err := i.upstreamService.ListCommit(ctx, upstreamCommitIds...) + if err != nil { + return nil, err + } + for _, c := range upstreamCommits { + upstreamRelease = &gateway.UpstreamRelease{ + BasicItem: &gateway.BasicItem{ + ID: c.Target, + Version: version, + MatchLabels: map[string]string{ + "serviceId": projectID, + }, + }, + PassHost: c.Data.PassHost, + Scheme: c.Data.Scheme, + Balance: c.Data.Balance, + Timeout: c.Data.Timeout, + Nodes: utils.SliceToSlice(c.Data.Nodes, func(n *upstream.NodeConfig) string { + return fmt.Sprintf("%s weight=%d", n.Address, n.Weight) + }), + } + + upstreamProxyHeaders = utils.SliceToSlice(c.Data.ProxyHeaders, func(n *upstream.ProxyHeader) *gateway.ProxyHeader { + return &gateway.ProxyHeader{ + Key: n.Key, + Value: n.Value, + Opt: n.OptType, + } + }) + } + r.Upstream = upstreamRelease + } apis := make([]*gateway.ApiRelease, 0, len(apiInfos)) hasUpstream := len(upstreamCommitIds) > 0 for _, a := range apiInfos { @@ -221,38 +256,15 @@ func (i *imlPublishModule) getProjectRelease(ctx context.Context, projectID stri Opt: h.OptType, } }) + apiInfo.ProxyHeaders = append(apiInfo.ProxyHeaders, upstreamProxyHeaders...) + apiInfo.Retry = proxy.Retry apiInfo.Timeout = proxy.Timeout } apis = append(apis, apiInfo) } r.Apis = apis - var upstreamRelease *gateway.UpstreamRelease - if len(upstreamCommitIds) > 0 { - upstreamCommits, err := i.upstreamService.ListCommit(ctx, upstreamCommitIds...) - if err != nil { - return nil, err - } - for _, c := range upstreamCommits { - upstreamRelease = &gateway.UpstreamRelease{ - BasicItem: &gateway.BasicItem{ - ID: c.Target, - Version: version, - MatchLabels: map[string]string{ - "serviceId": projectID, - }, - }, - PassHost: c.Data.PassHost, - Scheme: c.Data.Scheme, - Balance: c.Data.Balance, - Timeout: c.Data.Timeout, - Nodes: utils.SliceToSlice(c.Data.Nodes, func(n *upstream.NodeConfig) string { - return fmt.Sprintf("%s weight=%d", n.Address, n.Weight) - }), - } - } - r.Upstream = upstreamRelease - } + if len(strategyCommitIds) > 0 { strategyCommits, err := i.strategyService.ListStrategyCommit(ctx, strategyCommitIds...) if err != nil { From 5f40d5092cf846909dee5949bceca43ef95890ea Mon Sep 17 00:00:00 2001 From: Liujian <824010343@qq.com> Date: Fri, 8 Aug 2025 12:05:46 +0800 Subject: [PATCH 2/2] update qiniu rput param --- scripts/qiniu_publish.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/qiniu_publish.sh b/scripts/qiniu_publish.sh index 11d09881..0c4e1130 100755 --- a/scripts/qiniu_publish.sh +++ b/scripts/qiniu_publish.sh @@ -22,7 +22,7 @@ echo "login qiniu..." qshell account ${AccessKey} ${SecretKey} ${QINIU_NAME} echo "qshell rput ${QINIU_BUCKET} \"${APP}/images/${Tar}\" ${Tar}" -qshell rput ${QINIU_BUCKET} "${APP}/images/${Tar}" ${Tar} +qshell rput --overwrite ${QINIU_BUCKET} "${APP}/images/${Tar}" ${Tar} rm -f ${Tar} docker rmi -f ${ImageName}:${Version} \ No newline at end of file