Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-3121

Hudson returns http 405 when parameterized option is checked

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • core
    • None
    • Platform: All, OS: All

      When the "parameterized" option is checked within a build, Hudson is returning a
      HTTP 405.

      This was using Hudson 1.285

      This is a problem when using Hudson behind a proxy as the proxy will return only
      the HTTP 405 response code.

      Edit 2013/05/03: Some reverse proxies generate their own error pages, so Jenkins should not rely on the HTML body in the 405 response being presented to the user. This body is currently used to specify the parameters to use on a parameterized build.

      $ curl -v http://cu009.cubit.ibitdev.com:8080/job/test_params/build?delay=0sec

      • About to connect() to cu009.cubit.ibitdev.com port 8080 (#0)
      • Trying 208.87.8.211... connected
      • Connected to cu009.cubit.ibitdev.com (208.87.8.211) port 8080 (#0)
        > GET /job/test_params/build?delay=0sec HTTP/1.1
        > User-Agent: curl/7.16.3 (i686-pc-cygwin) libcurl/7.16.3 OpenSSL/0.9.8i zlib/1.
        2.3 libssh2/0.15-CVS
        > Host: cu009.cubit.ibitdev.com:8080
        > Accept: /
        >
        < HTTP/1.1 405 Method Not Allowed
        < Server: Winstone Servlet Engine v0.9.10
        < Expires: 0
        < Content-Type: text/html;charset=UTF-8
        < Connection: Close
        < Date: Mon, 23 Feb 2009 20:08:45 GMT
        < X-Powered-By: Servlet/2.5 (Winstone/0.9.10)
        < Set-Cookie: JSESSIONID=56cb51b13ed79bbc1c91c45fb397022f; Path=/
        <
        <html><head>

      <title>Hudson</title><link type="text/css" rel="stylesheet" href="/static/0d
      946710/css/style.css"></link><link type="text/css" rel="stylesheet" href="/stati
      c/0d946710/css/color.css"></link><link type="image/vnd.microsoft.icon" rel="shor
      tcut icon" href="/static/0d946710/favicon.ico"></link><script>var isRunAsTest=fa
      lse;</script><script src="/static/0d946710/scripts/prototype.js" type="text/java
      script"></script><script src="/static/0d946710/scripts/behavior.js" type="text/j
      avascript"></script><script src="/static/0d946710/scripts/sortable.js" type="tex
      t/javascript"></script><script src="/static/0d946710/scripts/yui/yahoo/yahoo-min
      .js"></script><script src="/static/0d946710/scripts/yui/dom/dom-min.js"></script
      ><script src="/static/0d946710/scripts/yui/event/event-min.js"></script><script
      src="/static/0d946710/scripts/yui/animation/animation-min.js"></script><script s
      rc="/static/0d946710/scripts/yui/container/container-min.js"></script><script sr
      c="/static/0d946710/scripts/yui/connection/connection-min.js"></script><script s
      rc="/static/0d946710/scripts/yui/autocomplete/autocomplete-min.js"></script><scr
      ipt src="/static/0d946710/scripts/yui/menu/menu-min.js"></script><script src="/s
      tatic/0d946710/scripts/yui/element/element-beta-min.js"></script><script src="/s
      tatic/0d946710/scripts/yui/button/button-min.js"></script><script src="/static/0
      d946710/scripts/yui/dragdrop/dragdrop-min.js"></script><script src="/static/0d94
      6710/scripts/hudson-behavior.js" type="text/javascript"></script><link type="tex
      t/css" rel="stylesheet" href="/static/0d946710/scripts/yui/container/assets/cont
      ainer.css"></link><link type="text/css" rel="stylesheet" href="/static/0d946710/
      scripts/yui/assets/skins/sam/skin.css"></link><link type="text/css" rel="stylesh
      eet" href="/static/0d946710/scripts/yui/button/assets/skins/sam/button.css"></li
      nk><link type="text/css" rel="stylesheet" href="/static/0d946710/scripts/yui/men
      u/assets/skins/sam/menu.css"></link><link type="application/opensearchdescriptio
      n+xml" rel="search" title="Hudson" href="/opensearch.xml"></link><meta content="
      INDEX,NOFOLLOW" name="ROBOTS"></meta><link type="application/rss+xml" rel="alter
      nate" title="Hudson:test_params (all builds)" href="rssAll"></link><link type="a
      pplication/rss+xml" rel="alternate" title="Hudson:test_params (all builds) (RSS
      2.0)" href="rssAll?flavor=rss20"></link><link type="application/rss+xml" rel="al
      ternate" title="Hudson:test_params (failed builds)" href="rssFailed"></link><lin
      k type="application/rss+xml" rel="alternate" title="Hudson:test_params (failed b
      uilds) (RSS 2.0)" href="rssFailed?flavor=rss20"></link><link type="application/r
      ss+xml" rel="alternate" title="Hudson:test_params (changelog)" href="rssChangelo
      g"></link><link type="application/rss+xml" rel="alternate" title="Hudson:test_pa
      rams (changelog) (RSS 2.0)" href="rssChangelog?flavor=rss20"></link></head><body
      class="yui-skin-sam"><a class="skiplink" href="#skip2content">Skip to content</
      a><table border="0" width="100%" cellpadding="0" cellspacing="0" id="header"><tr
      ><td id="top-panel" colspan="2"><table border="0" width="100%" cellpadding="0" c
      ellspacing="0"><tr><td style="font-weight:bold; font-size: 2em;"><a href="/"><im
      g src="/static/0d946710/images/title.png" alt="title"></img></a></td><td style="
      vertical-align: middle; text-align: right; padding-right: 1em;"><form style="pos
      ition:relative;" class="no-json" action="/job/test_params/search/" method="get"
      name="search"><div id="search-box-minWidth"></div><div id="search-box-sizer"></d
      iv><div id="searchform"><input class="has-default-text defaulted" value="search"
      id="search-box" name="q"></input>A <a href="http://hudson.gotdns.com/wiki/displ
      ay/HUDSON/Search+Box"><img src="/static/0d946710/images/16x16/help.png" alt="hel
      p for search"></img></a><div id="search-box-completion"></div><script>createSear
      chBox("/job/test_params/search/");</script></div></form></td><td id="login-field
      "><span>A <a style="color:inherit" href="/login?from=/job/test_params/build "><b
      >login</b></a>

      <a href="/signup"><b>sign up</b></a></span></td></tr></table></td></tr><tr i
      d="top-nav"><td id="left-top-nav"><a href="/">Hudson</a> A» <a href="/job/test_p
      arams/">test_params</a></td><td id="right-top-nav"><span class="smallfont"><a hr
      ef="?auto_refresh=true">ENABLE AUTO REFRESH</a></span></td></tr></table><table s
      tyle="background-image: url(/static/0d946710/images/hudson.png);
      background-repeat: no-repeat; background-position: bottom left;" border="0" widt
      h="100%" id="main-table" height="70%"><tr><td width="20%" id="side-panel"><div s
      tyle="margin-left: 20px; margin-right: 20px; border-top: 1px solid #bbb"></div><
      div id="navigation"><div id="tasks"><div class="task"><a href="/"><img src="/sta
      tic/0d946710/images/24x24/up.gif" style="margin: 2px;" width="24" alt="" height=
      "24"></img></a>A <a href="/">Back to Dashboard</a></div><div class="task"><a hre
      f="/job/test_params/"><img src="/static/0d946710/images/24x24/search.gif" style=
      "margin: 2px;" width="24" alt="" height="24"></img></a>A <a href="/job/test_para
      ms/">Status</a></div><div class="task"><a href="/job/test_params/changes"><img s
      rc="/static/0d946710/images/24x24/notepad.gif" style="margin: 2px;" width="24" a
      lt="" height="24"></img></a>A <a href="/job/test_params/changes">Changes</a></di
      v><div class="task"><a href="/job/test_params/ws/"><img src="/static/0d946710/im
      ages/24x24/folder.gif" style="margin: 2px;" width="24" alt="" height="24"></img>
      </a>A <a href="/job/test_params/ws/">Workspace</a></div><div class="task"><a hre
      f="/job/test_params/build?delay=0sec"><img src="/static/0d946710/images/24x24/cl
      ock.gif" style="margin: 2px;" width="24" alt="" height="24"></img></a>A <a href=
      "/job/test_params/build?delay=0sec">Build Now</a></div><script>
      function build(a) {
      new Ajax.Request(a.href,

      {method:"post"}

      );
      hoverNotification('Build scheduled',a.parentNode);
      return false;
      }
      </script><div class="task"><a href="/job/test_params/delete"><img src=
      "/static/0d946710/images/24x24/edit-delete.gif" style="margin: 2px;" width="24"
      alt="" height="24"></img></a>A <a href="/job/test_params/delete">Delete Project<
      /a></div><div class="task"><a href="/job/test_params/configure"><img src="/stati
      c/0d946710/images/24x24/setting.gif" style="margin: 2px;" width="24" alt="" heig
      ht="24"></img></a>A <a href="/job/test_params/configure">Configure</a></div></di
      v><table class="pane" id="buildHistory"><tr><td class="pane-header" colspan="2">
      <div style="float:right">(<a href="/job/test_params/buildTimeTrend">trend</a>)</
      div><div data="100" class="healthReport" onmouseover="this.className='healthRepo
      rt hover';return true;
      " onmouseout="this.className='healthReport';return true;"><a href="/job/
      test_params/lastBuild"><img src="/static/0d946710/images/16x16/health-80plus.gif
      " alt="100%"></img></a><div class="healthReportDetails"><table border="0"><thead
      ><tr><th align="left">W</th><th align="left">Description</th><th align="right">%
      </th></tr></thead><tbody><tr><td align="left"><img src="/static/0d946710/images/
      16x16/health-80plus.gif" title="" alt=""></img></td><td>Build stability: No rece
      nt builds failed.</td><td align="right">100</td></tr></tbody></table></div></div
      >Build History</td></tr><tr class="build-row "><td nowrap="nowrap"><img src="/st
      atic/0d946710/images/16x16/blue.gif" width="16" tooltip="Success" alt="Success"
      height="16"></img>A 
      #3
      </td><td nowrap="nowrap"><a class="tip" href="/job/test_params/3/">Feb 18, 2
      009 3:55:41 AM</a></td></tr><tr class="build-row "><td nowrap="nowrap"><img src=
      "/static/0d946710/images/16x16/blue.gif" width="16" tooltip="Success" alt="Succe
      ss" height="16"></img>A 
      #2
      </td><td nowrap="nowrap"><a class="tip" href="/job/test_params/2/">Feb 18, 2
      009 3:55:26 AM</a></td></tr><tr class="build-row "><td nowrap="nowrap"><img src=
      "/static/0d946710/images/16x16/blue.gif" width="16" tooltip="Success" alt="Succe
      ss" height="16"></img>A 
      #1
      </td><td nowrap="nowrap"><a class="tip" href="/job/test_params/1/">Feb 18, 2
      009 3:55:22 AM</a></td></tr><tr class="build-row"><td align="right" colspan="2">
      <a href="/job/test_params/rssAll"><img src="/static/0d946710/images/atom.gif" bo
      rder="0" alt="Feed"></img> for all</a>A <a href="/job/test_params/rssFailed"><im
      g src="/static/0d946710/images/atom.gif" border="0" alt="Feed"></img> for failur
      es</a></td></tr></table><script defer="true">
      updateBuildHistory("/job/test_params/buildHistory/ajax",4);
      </script></div></td><td width="80%" id="main-panel" height="100%"><a name="ski
      p2content"></a><h1>Project test_params</h1><p>This build requires parameters:</p
      ><form action="build" method="post"><table width="100%"><tr><td class="setting-l
      eftspace">A </td><td class="setting-name">TEST</td><td class="setting-main"><div
      name="parameter"><input type="hidden" value="TEST" name="name"></input><input n
      ame="value" value="" type="text" class="setting-input "></input></div></td></tr>
      <tr class="validation-error-area"><td colspan="2"></td><td></td></tr><tr><td col
      span="3"><input type="submit" class="submit-button" value="Build" name="Submit">
      </input></td></tr></table></form></td></tr></table><table width="100%"><tr><td i
      d="footer"><a href="http://hudson.dev.java.net/">

      • Closing connection #0
        Hudson ver. 1.285</a></td></tr></table></body></html>

          [JENKINS-3121] Hudson returns http 405 when parameterized option is checked

          andrewr added a comment -

          I think the sending of a 405 has to be a bug. I can't figure out from the
          situation why this would be the case, so I had to look up what a 405 is used in.
          From RFC 2616:

          10.4.6 405 Method Not Allowed

          The method specified in the Request-Line is not allowed for the resource
          identified by the Request-URI. The response MUST include an Allow header
          containing a list of valid methods for the requested resource.

          We don't send back a Allow header and it just doesn't make sense to me.

          The case is pretty rare, I did see it reported once on the Hudson mail list in
          another context, someone trying to trigger builds thru a blackberry:
          http://www.nabble.com/triggering-builds-from-a-Blackberry-possible--td21100243.html
          I think thats cause they're probably using a silently proxying browser.

          andrewr added a comment - I think the sending of a 405 has to be a bug. I can't figure out from the situation why this would be the case, so I had to look up what a 405 is used in. From RFC 2616: 10.4.6 405 Method Not Allowed The method specified in the Request-Line is not allowed for the resource identified by the Request-URI. The response MUST include an Allow header containing a list of valid methods for the requested resource. We don't send back a Allow header and it just doesn't make sense to me. The case is pretty rare, I did see it reported once on the Hudson mail list in another context, someone trying to trigger builds thru a blackberry: http://www.nabble.com/triggering-builds-from-a-Blackberry-possible--td21100243.html I think thats cause they're probably using a silently proxying browser.

          huybrechts added a comment -

          Going to /job/x/build will get you redirected to the parameter input page.
          To build a job with parameters, go to /job/x/buildWithParameters
          You can do a GET with the parameters in the query string, or a POST with
          key=value in the body.

          huybrechts added a comment - Going to /job/x/build will get you redirected to the parameter input page. To build a job with parameters, go to /job/x/buildWithParameters You can do a GET with the parameters in the query string, or a POST with key=value in the body.

          andrewr added a comment -

          Tom--

          I'm not sure I understand. A redirect (301 or 302) would be just fine.

          But a 405 isn't a redirect, and it tells a reverse proxy to give up or at least
          do something not predictable.

          andrewr added a comment - Tom-- I'm not sure I understand. A redirect (301 or 302) would be just fine. But a 405 isn't a redirect, and it tells a reverse proxy to give up or at least do something not predictable.

          Qian Qiao added a comment -

          I'm not sure using GET requests on /job/x/buildWithParameters is even a proper workaround, since it means that the "build" link on the left nav bar is completely useless, since it always points /job/x/build

          The fact is that 405 will cause Jenkins' UI to be unusable on RPs that generate their own error page, and I don't think there's a valid reason to use 405 instead of 302 here.

          I think this issue deserves to be re-opened and given more thought.

          Qian Qiao added a comment - I'm not sure using GET requests on /job/x/buildWithParameters is even a proper workaround, since it means that the "build" link on the left nav bar is completely useless, since it always points /job/x/build The fact is that 405 will cause Jenkins' UI to be unusable on RPs that generate their own error page, and I don't think there's a valid reason to use 405 instead of 302 here. I think this issue deserves to be re-opened and given more thought.

          John Koleszar added a comment -

          Agree, this issue needs to be reopened. Going to /job/x/build doesn't redirect you, it returns a 405, where the content is the parameter entry HTML. The problem is that some reverse proxies will replace this HTML with their own HTML, making the Jenkins UI unreachable. This is generally not configurable other than disabling the behavior entirely, which may not be an option. See ProxyErrorOverride in the Apache docs, for one example. It'd be better to have /job/x/build 302 to a parameter entry page that can be accessed via GET, that then POSTs to the buildWithParameter page.

          John Koleszar added a comment - Agree, this issue needs to be reopened. Going to /job/x/build doesn't redirect you, it returns a 405, where the content is the parameter entry HTML. The problem is that some reverse proxies will replace this HTML with their own HTML, making the Jenkins UI unreachable. This is generally not configurable other than disabling the behavior entirely, which may not be an option. See ProxyErrorOverride in the Apache docs, for one example. It'd be better to have /job/x/build 302 to a parameter entry page that can be accessed via GET, that then POSTs to the buildWithParameter page.

          John Koleszar added a comment -

          After digging at the source a bit, I think this issue was miscategorized, and is likely not due to the parameterized-trigger plugin. The 405 seems to be coming from one of these views in jenkins-core:

          core/src/main/resources/hudson/model/ParametersDefinitionProperty/index.jelly
          core/target/classes/hudson/model/ParametersDefinitionProperty/index.jelly

          Reopening to change the component.

          John Koleszar added a comment - After digging at the source a bit, I think this issue was miscategorized, and is likely not due to the parameterized-trigger plugin. The 405 seems to be coming from one of these views in jenkins-core: core/src/main/resources/hudson/model/ParametersDefinitionProperty/index.jelly core/target/classes/hudson/model/ParametersDefinitionProperty/index.jelly Reopening to change the component.

          Daniel Beck added a comment -

          Assuming fixed given the changes (e.g. JENKINS-13546) to build trigger responses.

          Daniel Beck added a comment - Assuming fixed given the changes (e.g. JENKINS-13546 ) to build trigger responses.

          Not sure why this was closed, as the issue still exists. When you use the UI to start a build, and click on the "Build with parameters" button, you always get a HTTP 405 response status code. The culprint, I believe, is this line: https://github.com/jenkinsci/jenkins/blob/master/core/src/main/resources/hudson/model/ParametersDefinitionProperty/index.jelly#L37

           

          As said before, this can cause problems depending on the proxy you're using.

          Jelle Sebreghts added a comment - Not sure why this was closed, as the issue still exists. When you use the UI to start a build, and click on the "Build with parameters" button, you always get a HTTP 405 response status code. The culprint, I believe, is this line: https://github.com/jenkinsci/jenkins/blob/master/core/src/main/resources/hudson/model/ParametersDefinitionProperty/index.jelly#L37   As said before, this can cause problems depending on the proxy you're using.

            Unassigned Unassigned
            dbowler_cn dbowler_cn
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: