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

badMessage: 400 Bad Host header for HttpChannelOverHttp

      Behind a reverse proxy a requests may fail with this error

      WARNING	o.e.jetty.util.log.JavaUtilLog#warn: badMessage: 400 Bad Host header for HttpChannelOverHttp@123456{r=0,c=false,a=IDLE,uri=/foo/bar/}
      

      In Jenkins 2.0 Jetty was upgraded from 8.1 to 9.2 which removes AJP functionality, and also requires that if the HOST: field is used it can not be empty.

      KO:

      GET /foo/bar HTTP/1.1\r\nHOST: \r\nConnection: Close\r\n\r\n
      

      OK:

      GET /foo/bar HTTP/1.1\r\nHOST:null \r\nConnection: Close\r\n\r\n
      

      Current winstone version includes Jetty server 9.2.15.v20160210.

      The fix is in 9.3.... See:
      https://github.com/eclipse/jetty.project/issues/592. https://github.com/eclipse/jetty.project/commit/7e16731b9dac0d5b6ae5424a13c83fd4ef46dc4f

      The Jetty version embedded in winstone must be upgraded to have a fix
      The workaround is to take care to never send an empty HOST

          [JENKINS-40693] badMessage: 400 Bad Host header for HttpChannelOverHttp

          Arnaud Héritier created issue -
          Oleg Nenashev made changes -
          Component/s New: core [ 15593 ]

          Oleg Nenashev added a comment -

          From what I see it's rather a regression than a new feature request

          Oleg Nenashev added a comment - From what I see it's rather a regression than a new feature request
          Oleg Nenashev made changes -
          Issue Type Original: New Feature [ 2 ] New: Bug [ 1 ]
          Oleg Nenashev made changes -
          Labels New: regression

          Oleg Nenashev added a comment -

          I was recently digging into Jetty project as a part of the research for a non-Jenkins Java server.

          We cannot easily upgrade to Jetty 9.3 because it EOLs the support of Java 7. If this issue really requires a fix ASAP, we need a temporary custom fork till Java 7 gets dropped in Jenkins.

          Oleg Nenashev added a comment - I was recently digging into Jetty project as a part of the research for a non-Jenkins Java server. We cannot easily upgrade to Jetty 9.3 because it EOLs the support of Java 7. If this issue really requires a fix ASAP, we need a temporary custom fork till Java 7 gets dropped in Jenkins.

          Oleg Nenashev added a comment -

          Alternative approach: Contribute backport to Jetty 9.2.x branch, which still seems to be alive: https://github.com/eclipse/jetty.project/blob/jetty-9.2.x/jetty-http/src/main/java/org/eclipse/jetty/http/HttpParser.java#L832-L838 . I am not sure they will accept it

          Oleg Nenashev added a comment - Alternative approach: Contribute backport to Jetty 9.2.x branch, which still seems to be alive: https://github.com/eclipse/jetty.project/blob/jetty-9.2.x/jetty-http/src/main/java/org/eclipse/jetty/http/HttpParser.java#L832-L838 . I am not sure they will accept it

          Maybe olamy could have some feedback ?

          Arnaud Héritier added a comment - Maybe olamy could have some feedback ?

          Daniel Beck added a comment -

          Why is this "Major" when the workaround is obviously to set the Host header? What am I missing here?

          Daniel Beck added a comment - Why is this "Major" when the workaround is obviously to set the Host header? What am I missing here?

          I had a doubt but we have nothing between Minor and Major
          The workaround is easy to apply but you need to find this issue (I hope it is correctly described/indexed to be found when required) and it a regression when you upgrade from 1.x to 2.x

          Arnaud Héritier added a comment - I had a doubt but we have nothing between Minor and Major The workaround is easy to apply but you need to find this issue (I hope it is correctly described/indexed to be found when required) and it a regression when you upgrade from 1.x to 2.x

            aheritier Arnaud Héritier
            aheritier Arnaud Héritier
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: