title: Bad Message 400: Folding Header
body: <p>We recently switched from Jetty v 6_1_26 to 9_4_11.</p>
  
  <p>We followed following url:
  <a href="http://jetty.4.x6.nabble.com/Configuring-option-2-of-RFC-7230-paragraph-5-HTTP-header-folding-td4966330.html" rel="nofollow noreferrer">http://jetty.4.x6.nabble.com/Configuring-option-2-of-RFC-7230-paragraph-5-HTTP-header-folding-td4966330.html</a></p>
  
  <p>And made required changes in our code to set the compliance mode to RFC2616 as we need multiple-line header support in our product.</p>
  
  <p>This is how we have set it:</p>
  
  <pre class="lang-java prettyprint-override"><code>public class JettyPsServerConnector extends ServerConnector {
    public JettyServerConnector(Server server, PsSelectorProvider psProvider,Map&lt;String,String&gt; configMap, boolean useSSL) throws Exception{
  
      super(server,0,-1, new SslConnectionFactory( getSSLContextFactory(configMap),HttpVersion.HTTP_1_1.asString()),
                             new HttpConnectionFactory( getHTTPConfiguration(), HttpCompliance.RFC2616 ));
  
      }
  </code></pre>
  
  <p>And we have verified it successfully using following code that the compliance mode is getting changed.</p>
  
  <pre><code>Connector[] connectorArray = server.getConnectors();
  for(Connector conn: connectorArray){
      Collection col = conn.getConnectionFactories();
      for(ConnectionFactory con: col){
          if (con instanceof HttpConnectionFactory)
              System.out.println("HTTP Compliance Mode:"+((HttpConnectionFactory)con).getHttpCompliance());
                      }
          }
  </code></pre>
  
  <p>This prints compliance mode as 'RFC2616'.</p>
  
  <p>But even after setting the compliance mode to RFC2616 - we still see this issue.</p>
  
  <pre><code>Bad Message 400: Folding Header
  </code></pre>
  
  <p>We are hitting our server code through a proxy server in between.</p>
  
  <p>We are not able to figure out what can cause this.</p>