Skip to content

max_redirects: 0 doesn't seem to work #1217

Closed

Description

@rweir

Describe the bug

I have set up a probe to confirm that I've correctly configured a HTTP redirect on a server, using max_redirects like this:

/etc/cloudprober.cfg snippet:

probe {
  name: "http_redirect"
  type: HTTP
  targets {
    file_targets {
      file_path: "/etc/cloudprober/external/redirect.textpb"
      re_eval_sec: 30
    }
  }
  http_probe {
    protocol: HTTP
    max_redirects: 0
  }
  interval: "60s"
  timeout: "10s"
  validator {
    name: "status_code_redirect"
    http_validator {
      success_status_codes: "301"
    }
  }
}

/etc/cloudprober/external/redirect.textpb:

resource {
    name: "google.com"
    ip: "google.com"
}

I simply could not manage to get it to pass - it just kept failing and producing log messages like this:

Feb 08 22:45:26 mon cloudprober[2523362]: time=2026-02-08T22:45:26.792Z level=WARN source=internal/validators/http/http.go:227 msg="HTTP validation failure: status code 200 not in success status codes: 301, status: 200 OK, " system=cloudprober probe=http_redirect

ie it got a 200, which it correctly considered to be wrong (it's not a 301), however manual testing disagrees:

curl -v  https://google.com/
...
< HTTP/2 301

Eventually I thought it might be a bug, so had a bit of a look around the source and found that p.redirectFunc was set but not referred to the http.Client.

Cloudprober Version

v0.14.1

To Reproduce
Steps to reproduce the behavior:

Load the above configuration in to cloudprober.

Additional context

I've put up a PR.

Activity

  1. added
    bug
    on Feb 8, 2026
  2. added this to the v0.14.2 milestone on Feb 13, 2026
  3. manugarg commented on Feb 13, 2026

    @manugarg
    Contributor

    @rweir thanks for reporting and fixing this bug. It will go out with the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions