Issue
I’m trying to make an API call to my Jenkins instance using my domain user but it’s failing with:
curl: (7) Failed to connect to yourdomain.com port X: Connection timed out
It mainly affects users with a "@" character.
Environment
-
CloudBees CI (CloudBees Core) on modern cloud platforms - Managed controller
-
CloudBees CI (CloudBees Core) on modern cloud platforms - Operations Center
-
CloudBees CI (CloudBees Core) on traditional platforms - Client controller
-
CloudBees CI (CloudBees Core) on traditional platforms - Operations Center
Resolution
This is caused by the "@" character, that makes the call interpret your user’s domain as the URL to reach.
It can be fixed by replacing your call, defining the user and token as an argument.
-
Example of a command that will fail
curl https://youruser@yourdomain.com:yourtoken@jenkins.yourdomain.com/api/json
-
Example of a successful command
curl -u youruser@yourdomain.com:yourtoken https://jenkins.yourdomain.com/api/json