JuliusBrussee/caveman · error

HTTPS required; HTTP is test-only on explicit loopback

Error message

HTTPS required; HTTP is test-only on explicit loopback

What it means

validateReplayBaseURL was given an http:// (or other non-https) base URL that is not permitted: HTTP is allowed only for test traffic to an explicit loopback host when allowInsecureLoopback is set. Any non-https scheme targeting a non-loopback host, or loopback without the flag, fires this guard.

Solutions

  1. Use an https:// base URL for real replay targets
  2. For local test servers, keep http:// but bind to an explicit loopback host (127.0.0.1/[::1]) and enable the allow-insecure-loopback option
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cacheengine/cachebench/replay_http.go:265 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of JuliusBrussee/caveman@766dce6b13 (2026-08-18). Data as JSON: /api/errors/10ad146caed0f4e9. Report an issue: GitHub.

Appendix: source

Thrown at cacheengine/cachebench/replay_http.go:265

		}
	default:
		return errors.New("cachebench: unsupported replay provider")
	}
	return nil
}

func validateReplayBaseURL(raw string, allowInsecureLoopback bool) (*url.URL, error) {
	parsed, err := url.Parse(strings.TrimSpace(raw))
	if err != nil || parsed.Host == "" || parsed.User != nil || parsed.RawQuery != "" || parsed.Fragment != "" {
		return nil, errors.New("invalid absolute base URL")
	}
	if parsed.Scheme == "https" {
		return parsed, nil
	}
	if parsed.Scheme == "http" && allowInsecureLoopback && isLoopbackHost(parsed.Hostname()) {
		return parsed, nil
	}
	return nil, errors.New("HTTPS required; HTTP is test-only on explicit loopback")
}

func validReplaySecret(value string) bool {
	return validBoundedText(value, 16*1024, false)
}

func validAWSRegion(value string) bool {
	if len(value) < 3 || len(value) > 64 {
		return false
	}
	for _, char := range value {
		if char >= 'a' && char <= 'z' || char >= '0' && char <= '9' || char == '-' {
			continue
		}
		return false
	}
	return true
}

View on GitHub (pinned to 766dce6b13)