Skip to content

fix(api-client): skip connectivity request when a proxy is configured - #9360

Open
pustelnik wants to merge 2 commits into
apache:mainfrom
pustelnik:fix/8632-proxy-test-request
Open

pustelnik wants to merge 2 commits into
apache:mainfrom
pustelnik:fix/8632-proxy-test-request

Conversation

@pustelnik

Copy link
Copy Markdown

⚠️ Pre Checklist

  • I have read through the Contributing Documentation.
  • I have added relevant tests.
  • I have added relevant documentation. (Not needed: no user-facing configuration or API changes.)
  • I will add labels to the PR, such as pr-type/bug-fix, pr-type/feature-development, etc. (Please add pr-type/bug-fix if I can't set labels myself.)

Summary

When a connection has a proxy configured, NewApiClient sent GET / to the endpoint through the proxy as a connectivity check, before any authentication was set up.

On Jira Data Center with SSO, the API root redirects to a login page, so this request failed with stopped after 10 redirects and the connection could not be tested or used. Without a proxy this request is never sent, which is why the same connection works on a host with direct access.

This PR removes that request. Every plugin's test-connection and collection code already calls its own API right after creating the client (e.g. Jira's api/2/serverInfo), so a broken proxy or unreachable host still fails, just on that first real request. The DNS and port checks for connections without a proxy are unchanged.

Behaviour change: when a proxy returns 502, the error is now the plugin's own message (e.g. unexpected status code: 502) instead of fail to connect to <endpoint> via <proxy>.

Tests: added TestNewApiClientWithProxyDoesNotProbeEndpoint in helpers/pluginhelper/api/api_client_test.go. A fake proxy redirects every request back to itself, like the SSO loop. The test checks that client creation succeeds without sending anything through the proxy, and that later requests still go through it. It fails on the old code.

Does this close any open issues?

Closes #8632

Screenshots

N/A

Other Information

I've been running this fix on v1.0.3-beta19 behind a corporate proxy. It might be worth backporting to release-v1.0.

🤖 Generated with Claude Code

pustelnik and others added 2 commits November 10, 2026 09:36
When a proxy is set, NewApiClient sent GET / to the endpoint as a
connectivity check. Jira Data Center behind SSO redirects the API root
to a login page, so the check failed with "stopped after 10 redirects"
and the connection could not be used. Plugins already test their own
API endpoints, so drop the extra request.

Fixes apache#8632

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: jpustelnik <jakub.pustelnik@gmail.com>
Regression test for apache#8632. A fake proxy redirects every
request to itself, like an SSO login loop. NewApiClient must succeed and
send nothing through it; later requests must still use the proxy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: jpustelnik <jakub.pustelnik@gmail.com>
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.

[Bug][Jira][REST API] Jira DataCenter with SSO doesn't work with proxy

1 participant