Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import (
"encoding/json"
"net/url"
"strings"

"github.com/pkg/errors"
Expand All @@ -37,6 +38,12 @@
}
req := &providerDto.ServiceReqDto{}
req.Url = dto.RedirectAddr
if u, err := url.Parse(dto.RedirectAddr); err == nil && u.Host != "" {
u.Path = ""
u.RawQuery = ""
u.Fragment = ""
req.Url = u.String()

Check warning on line 45 in internal/tools/orchestrator/hepa/gateway/assembler/gateway_kong_assembler.go

View check run for this annotation

Codecov / codecov/patch

internal/tools/orchestrator/hepa/gateway/assembler/gateway_kong_assembler.go#L41-L45

Added lines #L41 - L45 were not covered by tests
Comment on lines +42 to +45

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve static redirect paths

When a manual RT_URL API uses a static RedirectPath, verifyApiCreateParams/verifyApiUpdateParams append that path to RedirectAddr, and pathAdjust only installs the path-variable rewrite plugin when the backend path contains variables. For inputs such as redirectAddr=http://upstream and redirectPath=/api, clearing u.Path here changes Kong's service URL from http://upstream/api to http://upstream, so requests are forwarded without the configured backend prefix and existing static-prefix APIs will hit the wrong upstream path.

Useful? React with 👍 / 👎.

}
req.ConnectTimeout = 5000
req.ReadTimeout = 600000
req.WriteTimeout = 600000
Expand Down
Loading