open-telemetry / open-telemetry/opentelemetry-java-contrib
[opamp] HTTP redirects cause havoc
@LikeTheSalad is already working on this.
Since Apr 22, 2026.
- Dominant language
- Java
- Stars
- 269
- Forks
- 196
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 38
Description
If the initial URL for the opamp client points to a resource that returns a redirect (HTTP 301 or 302), the underlying okhttp client will turn around and issue a GET request to the redirected Location. This is not normal expected behavior, but can happen if a resource moves or if the client is misconfigured.
See https://github.com/square/okhttp/issues/6627 for additional context about this behavior.
You can reproduce this by setting the opamp endpoint url to http://cisco.com/
The end result is that the connection is considered successful and the callback onConnect() is called...which appears as success...even though we are not connected to a valid opamp server.
What can we do about it? I'm not sure yet, but there are a couple options:
- maybe we should always fail in the event that a redirect is returned to the POST?
- ...or maybe add an okhttp interceptor that somehow detects this 301/302 response to a POST and ensures that the following requests are also POST (maybe all requests should always be POST?)
- ...or maybe (also?) wait until after the response is successfully decoded as protobuf before determining connection success.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.