API calls to api/json endpoints are failing on Jenkins

Hi Folks,

When we try to access api/json for any Jenkins Job, build failing with Proxy error in one of our Jenkins instance but same is working fine on other Jenkins instance
Both instance are same In terms of configurations vise. Hence we are unable to find root cause.

Jenkins Version: 2.462.2

eg., https://job-name/api/json

It would be great if someone can assist us with this issue.

Thanks in advance.

The issue you’re having with accessing the api/json endpoint could be due to several reasons. :thinking:
Here are some steps that may help diagnose the issue:

  • Make sure that the proxy settings are correctly configured on the Jenkins instance that is failing. You can check the proxy settings in Jenkins under /manage/configure, HTTP Proxy Configuration
  • Verify that the network configuration, including firewall rules and network routes, are the same for both Jenkins instances. Ensure that the failing instance can reach the internet and the required endpoints.
  • Review the Jenkins logs for any errors or warnings related to proxy settings or network issues. The logs can be found under Manage Jenkins → System Log.
  • Sometimes, proxy servers require specific HTTP headers to be set. Ensure that the necessary headers are being sent in the request.
  • Compare the environment variables on both Jenkins instances to ensure they are identical, especially those related to proxy settings (e.g., http_proxy, https_proxy, no_proxy).
  • Test the proxy connectivity from the Jenkins instance that is failing. You can use tools like curl or wget to test the connectivity through the proxy.

curl -v -x http://your-proxy-server:port https://job-name/api/json

This command will help you see if the proxy server is reachable and if there are any issues with the connection. :crossed_fingers: