Skip to content

fix: rewrite download URL host to match HARNESS_BASE_URL for TLS compatibility#40

Open
mehulparmariitr wants to merge 1 commit intoharness:masterfrom
mehulparmariitr:fix/tls-download-logs-url-rewrite
Open

fix: rewrite download URL host to match HARNESS_BASE_URL for TLS compatibility#40
mehulparmariitr wants to merge 1 commit intoharness:masterfrom
mehulparmariitr:fix/tls-download-logs-url-rewrite

Conversation

@mehulparmariitr
Copy link

@mehulparmariitr mehulparmariitr commented Mar 10, 2026

Summary

  • Fixes download_execution_logs TLS certificate errors when HARNESS_BASE_URL is set to a custom/vanity domain (e.g., mycompany.harness.io)
  • Rewrites the pre-signed download URL host to match the configured base URL so it routes through the same trusted endpoint
  • Uses the configured HTTP client (with its TLS transport) instead of bare http.Get() for the download request

Root Cause

The Harness /blob/download API returns pre-signed download URLs hardcoded to app.harness.io. When HARNESS_BASE_URL points to a different domain, the second HTTP call to app.harness.io fails because the corporate proxy/CA doesn't trust that certificate. Every other MCP tool works because they only make API calls to the configured base URL.

Changes

  • common/client/logs.go — Added rewriteDownloadURLHost() to replace the download URL host/scheme with the configured BaseURL host. Falls back gracefully to the original URL if rewriting fails.
  • common/client/client.go — Added HTTPClient() accessor to expose the underlying *http.Client so callers can share the same TLS/transport config without auth header injection.
  • common/pkg/tools/logs.go — Added HTTPClient field to DownloadLogsConfig and replaced bare http.Get() with the configured client.
  • common/client/logs_test.go — 5 test cases for URL rewriting (host rewrite, no-op when matching, nil base URL, query param preservation, path preservation).

Fixes #39

Test plan

  • All existing tests pass (go test ./common/client/... ./common/pkg/tools/...)
  • New unit tests for rewriteDownloadURLHost pass (5 cases)
  • Manual test: set HARNESS_BASE_URL to a custom domain and verify download_execution_logs succeeds

🤖 Generated with Claude Code

@CLAassistant
Copy link

CLAassistant commented Mar 10, 2026

CLA assistant check
All committers have signed the CLA.

…atibility

Fixes download_execution_logs TLS certificate errors when HARNESS_BASE_URL
is set to a custom/vanity domain (e.g., mycompany.harness.io).

The /blob/download API returns pre-signed URLs hardcoded to app.harness.io.
This rewrites the host to match the configured base URL and uses the
configured HTTP client with its TLS/proxy settings instead of bare http.Get().

Fixes harness#39

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mehulparmariitr mehulparmariitr force-pushed the fix/tls-download-logs-url-rewrite branch from 229f9c8 to 80522a1 Compare March 10, 2026 10:42
@mehulparmariitr
Copy link
Author

When is this going to be merged @yogeshkc ?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

download_execution_logs fails with TLS error when HARNESS_BASE_URL differs from app.harness.io

3 participants