Jenkins HttpRequest Plugin - 404 not found

2019-08-24 20:12发布

问题:

I am getting 404 not found for HTTP GET Request in Jenkins for HTTPRequest plugin. I'm using https://httpbin.org/get for testing purposes. It is basically a GET request call.

Please be informed that my Jenkins is running behind a proxy. I have set up proxy for jenkins in Manage Jenkins -> Manage Plugins -> Advanced tab. Plugin downloads are working fine.

Please see the log below from the jenkins build console:

>

 Building in workspace C:\Users\bcn8cob\.jenkins\workspace\TestWebservice
HttpMethod: GET
URL: https://httpbin.org/get
Sending request to url: https://httpbin.org/get
Treating UnknownHostException(httpbin.org) as 404 Not Found
ERROR: Build step failed with exception
hudson.AbortException: Fail: the returned code 404 is not in the accepted range: [[100?399]]
    at jenkins.plugins.http_request.HttpRequestExecution.responseCodeIsValid(HttpRequestExecution.java:299)
    at jenkins.plugins.http_request.HttpRequestExecution.processResponse(HttpRequestExecution.java:309)
    at jenkins.plugins.http_request.HttpRequestExecution.authAndRequest(HttpRequestExecution.java:225)
    at jenkins.plugins.http_request.HttpRequestExecution.call(HttpRequestExecution.java:191)
Caused: java.lang.IllegalStateException
    at jenkins.plugins.http_request.HttpRequestExecution.call(HttpRequestExecution.java:194)
    at jenkins.plugins.http_request.HttpRequestExecution.call(HttpRequestExecution.java:65)
    at hudson.remoting.LocalChannel.call(LocalChannel.java:45)
    at jenkins.plugins.http_request.HttpRequest.perform(HttpRequest.java:304)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:735)
    at hudson.model.Build$BuildExecution.build(Build.java:206)
    at hudson.model.Build$BuildExecution.doRun(Build.java:163)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:490)
    at hudson.model.Run.execute(Run.java:1735)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:405)
Build step 'HTTP Request' marked build as failure
[IBM Cloud DevOps] Not building Deployable Message.
Finished: FAILURE

Do i need to set proxy for the HttpRequest plugin as well? What do you think?

回答1:

Proxy configuration is now supported and it makes use of proxy settings in manage-plugin-> Advance.

https://github.com/jenkinsci/http-request-plugin/pull/29

However, no-proxy or exceptions are not still considered, use curl in such cases.