open-telemetry / open-telemetry/opentelemetry-java-contrib

[opamp] HTTP redirects cause havoc

Open
#2,777 0 comments 0 reactions 2 assignees View on GitHub

@LikeTheSalad is already working on this.

Since Apr 22, 2026.

component:opamp-client
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.