Search code examples
javahttp-headersapache-cameljettyapache-karaf

Jetty Apache Camel - max headers size - 431 error


I have definied rest endpoint in apache camel (runs inside karaf) and I receive very large (>8500) header. Jetty throws 431 status code (Request Header Fields Too Large). Is there any possibility to avoid checking headers size (just temporary) or to change the limit? I use jetty like this:

restConfiguration()
        .component("jetty")
        .port("7777");


RestDefinition restDefinition = rest(REST_PATH)
    .consumes("application/json")
    .produces("application/json");

restDefinition.get("view2").to("direct:getView2");

There is this method

.clientRequestValidation(false)

...but it does not work


Solution

  • You can configure the requestHeaderSize option on the Camel jetty component, to set a higher value. See the docs at: https://camel.apache.org/components/latest/jetty-component.html

    Since you use rest-dsl you can set component options via componentProperty on the restConfiguration. See the rest dsl docs at: https://camel.apache.org/manual/latest/rest-dsl.html