I'm running Jenkins behind corporate proxy. My proxy password contains special characters something like 'P@ssw0rd'.
Getting below exception while building pipeline
Started by user unknown or anonymous
java.net.URISyntaxException: Illegal character in hostname at index 38: http://user:P%40ssw0rd@internet_proxy.abc.com:80
at java.net.URI$Parser.fail(URI.java:2848)
at java.net.URI$Parser.parseHostname(URI.java:3387)
at java.net.URI$Parser.parseServer(URI.java:3236)
at java.net.URI$Parser.parseAuthority(URI.java:3155)
at java.net.URI$Parser.parseHierarchical(URI.java:3097)
at java.net.URI$Parser.parse(URI.java:3053)
at java.net.URI.<init>(URI.java:673)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1751)
Caused: hudson.plugins.git.GitException: Failed to create http proxy uri
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1755)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$400(CliGitAPIImpl.java:72)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:442)
at jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:351)
at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:198)
at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:174)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:108)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:67)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:293)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Finished: FAILURE
I'm getting a positive response in validating proxy with test URL.
Proxy URL snippet –
http://user:P%40ssw0rd@internet_proxy.abc.com:80
Best Answer
Any "special" character needs to be percent-escaped, particularly
@
, because that is the separator between the password and hostname portions of a URL.