-
Notifications
You must be signed in to change notification settings - Fork 207
Open
Labels
Description
Description
The refreshMajorServerVersion method in HTTPTransport currently constructs an incorrect URL when fetching APM Server version information. The implementation ignores any path prefix configured in the APM Server URL, resulting in requests to the server root path instead of the configured endpoint.
Steps to Reproduce
- Configure APM Server URL with a path prefix (e.g.,
https://example.com/apm_server) - Agent attempts to check server version during initialization
- Observe the actual request URL being made to
https://example.com/instead ofhttps://example.com/apm_server
Expected Behavior
The version check request should preserve the path prefix from the configured APM Server URL.
For configuration https://example.com/apm_server, the request should be sent to https://example.com/apm_server/.
Actual Behavior
The current implementation strips all path components and sends requests to the server root:
u := *srvURL
u.Path, u.RawPath = "", "" // This discards any existing path
urlWithPath(&u, "/") // Forces root pathCode Reference
Relevant code in http_transport.go:
func (t *HTTPTransport) refreshMajorServerVersion(ctx context.Context) uint32 {
srvURL := t.intakeURLs[atomic.LoadInt32(&t.urlIndex)]
u := *srvURL
u.Path, u.RawPath = "", "" // Problematic line
req := requestWithContext(ctx, t.newRequest("GET", urlWithPath(&u, "/")))
// ... rest of implementation ...
}