首页 > 解决方案 > Jetty Apache Camel - 最大标头大小 - 431 错误

问题描述

我已经在 apache camel 中定义了休息端点(在 karaf 内运行)并且我收到了非常大的(> 8500)标头。Jetty 抛出 431 状态码(请求标头字段太大)。是否有可能避免检查标头大小(只是暂时的)或更改限制?我像这样使用码头:

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


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

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

有这个方法

.clientRequestValidation(false)

...但它不起作用

标签: javahttp-headersapache-cameljettyapache-karaf

解决方案


您可以requestHeaderSize在 Camel jetty 组件上配置该选项,以设置更高的值。请参阅以下文档:https ://camel.apache.org/components/latest/jetty-component.html

由于您使用的是 rest-dsl,因此您可以componentProperty通过restConfiguration. 请参阅以下 dsl 文档:https ://camel.apache.org/manual/latest/rest-dsl.html


推荐阅读