pustelnik opened a new pull request, #9360:
URL: https://github.com/apache/devlake/pull/9360

   ### ⚠️ Pre Checklist
   
   - [x] I have read through the [Contributing 
Documentation](https://devlake.apache.org/community/).
   - [x] I have added relevant tests.
   - [x] I have added relevant documentation. (Not needed: no user-facing 
configuration or API changes.)
   - [x] 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](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to