Repository navigation
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pr-type/bug-fix,pr-type/feature-development, etc. (Please addpr-type/bug-fixif I can't set labels myself.)Summary
When a connection has a proxy configured,
NewApiClientsentGET /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 redirectsand 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 offail to connect to <endpoint> via <proxy>.Tests: added
TestNewApiClientWithProxyDoesNotProbeEndpointinhelpers/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-beta19behind a corporate proxy. It might be worth backporting torelease-v1.0.🤖 Generated with Claude Code