Skip to content

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

Closed

Description

@jenkins-infra-bot

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:
jetty/jetty.project#592. jetty/jetty.project@7e16731

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


Originally reported by aheritier, imported from: badMessage: 400 Bad Host header for HttpChannelOverHttp
  • assignee: aheritier
  • status: Resolved
  • priority: Minor
  • component(s): core, winstone-jetty
  • label(s): 2.60.1-rejected, 2.60.2-rejected, 2.60.3-rejected, regression
  • resolution: Fixed
  • resolved: 2017-05-26T08:06:29+00:00
  • votes: 1
  • watchers: 4
  • imported: 2025-11-24
Raw content of original issue

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: jetty/jetty.project#592. jetty/jetty.project@7e16731

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

  • environment: Jenkins 2+

Activity

  1. jenkins-infra-bot commented on Dec 27, 2016

    @jenkins-infra-bot
    Author
  2. jenkins-infra-bot commented on Dec 27, 2016

    @jenkins-infra-bot
    Author
    oleg_nenashev:
    • Original comment link
    • Raw content of original comment:

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

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

  3. jenkins-infra-bot commented on Dec 27, 2016

    @jenkins-infra-bot
    Author
    oleg_nenashev:
    • Original comment link
    • Raw content of original 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.

    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.

  4. jenkins-infra-bot commented on Dec 27, 2016

    @jenkins-infra-bot
    Author
    oleg_nenashev:

    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

  5. jenkins-infra-bot commented on Dec 27, 2016

    @jenkins-infra-bot
    Author
    aheritier:
    • Original comment link
    • Raw content of original comment:

      Maybe olamy could have some feedback ?

    Maybe olamy could have some feedback ?

  6. jenkins-infra-bot commented on Dec 27, 2016

    @jenkins-infra-bot
    Author
    danielbeck:
    • Original comment link
    • Raw content of original comment:

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

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

  7. jenkins-infra-bot commented on Dec 27, 2016

    @jenkins-infra-bot
    Author
    aheritier:
    • Original comment link
    • Raw content of original 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

    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

  8. jenkins-infra-bot commented on Dec 30, 2016

    @jenkins-infra-bot
    Author
    olamy:
    • Original comment link
    • Raw content of original comment:

      Sorry for delay I was a bit busy those last days. I'm having a look. Shouldn't be a drama to backport this fix. We will let you know.

    Sorry for delay I was a bit busy those last days. I'm having a look. Shouldn't be a drama to backport this fix. We will let you know.

  9. jenkins-infra-bot commented on Jan 1, 2017

    @jenkins-infra-bot
    Author
    olamy:

    fix backported to jetty-9.2.x branch.
    9.2.21-SNAPSHOT deployed to https://oss.sonatype.org/content/repositories/jetty-snapshots
    let me know how it works with the fix.

  10. jenkins-infra-bot commented on Jan 4, 2017

    @jenkins-infra-bot
    Author
    aheritier:
    • Original comment link
    • Raw content of original comment:

      olamy I reached my teams to see how we can validate the fix

    olamy I reached my teams to see how we can validate the fix

  11. jenkins-infra-bot commented on Jan 7, 2017

    @jenkins-infra-bot
    Author
    oleg_nenashev:

    Assigned the issue to aheritier

  12. jenkins-infra-bot commented on Jan 30, 2017

    @jenkins-infra-bot
    Author
  13. jenkins-infra-bot commented on Apr 17, 2017

    @jenkins-infra-bot
    Author
    oleg_nenashev:
    • Original comment link
    • Raw content of original comment:

      olamy Is this issue bad enough to consider backporting to 2.46.3? If no, maybe we should upgrade Weekly directly to 9.3.latest

    olamy Is this issue bad enough to consider backporting to 2.46.3? If no, maybe we should upgrade Weekly directly to 9.3.latest

  14. jenkins-infra-bot commented on Apr 17, 2017

    @jenkins-infra-bot
    Author
    danielbeck:
    • Original comment link
    • Raw content of original comment:

      Not worth it IMO.

    Not worth it IMO.

  15. jenkins-infra-bot commented on Apr 17, 2017

    @jenkins-infra-bot
    Author
    olamy:
    • Original comment link
    • Raw content of original comment:

      agree. 9.3 latest is better  ( Java 8 mandatory)

       

    agree. 9.3 latest is better  ( Java 8 mandatory)

     

  16. jenkins-infra-bot commented on May 4, 2017

    @jenkins-infra-bot
    Author
    scm_issue_link:
    • Original comment link
    • Raw content of original comment:

      Code changed in jenkins User: Olivier Lamy Path: README.md pom.xml src/java/winstone/HostConfiguration.java src/java/winstone/HttpsConnectorFactory.java src/java/winstone/LocalStrings.properties src/java/winstone/cmdline/Option.java src/java/winstone/realm/ArgumentsRealm.java src/java/winstone/realm/FileRealm.java src/testwebapp/WEB-INF/web.xml http://jenkins-ci.org/commit/winstone/16a1f190035a9ac32c62b9736c30808cfa5ff63d Log: Merge pull request #32 from olamy/features/jetty_9.2.21.v20170120

      [JENKINS-40693, JENKINS-43713] upgrade to jetty 9.4.x

      Compare: jenkinsci/winstone@59d84ed...16a1f19

    Code changed in jenkins
    User: Olivier Lamy
    Path:
    README.md
    pom.xml
    src/java/winstone/HostConfiguration.java
    src/java/winstone/HttpsConnectorFactory.java
    src/java/winstone/LocalStrings.properties
    src/java/winstone/cmdline/Option.java
    src/java/winstone/realm/ArgumentsRealm.java
    src/java/winstone/realm/FileRealm.java
    src/testwebapp/WEB-INF/web.xml
    http://jenkins-ci.org/commit/winstone/16a1f190035a9ac32c62b9736c30808cfa5ff63d
    Log:
    Merge pull request #32 from olamy/features/jetty_9.2.21.v20170120

    [JENKINS-40693, JENKINS-43713] upgrade to jetty 9.4.x

    Compare: jenkinsci/winstone@59d84ed...16a1f19

  17. jenkins-infra-bot commented on May 26, 2017

    @jenkins-infra-bot
    Author
    scm_issue_link:

    Code changed in jenkins
    User: Oleg Nenashev
    Path:
    CHANGELOG.md
    http://jenkins-ci.org/commit/winstone/05adc4a50eeca136b3d1ed28b3e3149dc4b817f9
    Log:
    Changelog: Mention JENKINS-40693 in 4.0

  18. jenkins-infra-bot commented on May 26, 2017

    @jenkins-infra-bot
    Author
    oleg_nenashev:
    • Original comment link
    • Raw content of original comment:

      The issue has been fixed in Winstone 4.0 and integrated into Jenkins 2.61

      It is not an LTS candidate for 2.60.x LTS

    The issue has been fixed in Winstone 4.0 and integrated into Jenkins 2.61

    It is not an LTS candidate for 2.60.x LTS

  19. jenkins-infra-bot commented on Jun 12, 2017

    @jenkins-infra-bot
    Author
    scm_issue_link:

    Code changed in jenkins
    User: Oleg Nenashev
    Path:
    content/_data/changelogs/weekly.yml
    http://jenkins-ci.org/commit/jenkins.io/bd7e8598e4b85d84286ded5f2e6d71d08d8531ee
    Log:
    Add missing changelog entries for JENKINS-23273 and JENKINS-40693

  20. jenkins-infra-bot commented on Jun 12, 2017

    @jenkins-infra-bot
    Author
    scm_issue_link:

    Code changed in jenkins
    User: Daniel Beck
    Path:
    content/_data/changelogs/weekly.yml
    http://jenkins-ci.org/commit/jenkins.io/d6c1369d8ebcdff4a9f126097ecc6a7c30ea1d86
    Log:
    Merge pull request #921 from oleg-nenashev/changelog/missing-entries

    Add missing changelog entries for JENKINS-23273 and JENKINS-40693

    Compare: jenkins-infra/jenkins.io@14212ab...d6c1369

  21. removed
    bugFor changelog: Minor bug. Will be listed after features
    on Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions