0
votes

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

1
Obvious question, why are you abusing HTTP and not using it properly (eg: don't make giant query strings, but use POST/PUT/etc with a request body instead)? Large headers like that are often rejected by many intermediaries as well (firewalls, load balancers, etc). And are discouraged with HTTP/2 and HTTP/3. (Many implementations cannot actually handle the nuances of that kind of header with HTTP/2) - Joakim Erdfelt
I can do nothing with it. It does not depend on me. There is always a get and always with large header. - Resu
Karaf + camel is a complicated combination. Please edit your question and add any details of your particular setup. Eg: who is in control of your Jetty instance in that scenario (karaf? pax? camel? jetty-home? osgi-http-server? jetty-osgi-boot? etc) How have you deployed those Jetty components/bundles? - Joakim Erdfelt

1 Answers

1
votes

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