6

Using Ring's Jetty adapter, if my request is too large I get a 413: FULL HEAD error. I tracked it down to a property called headerbuffersize, but when I try to set it in the run-jetty call, I still get the 413's. Is there a better way to control jetty config from Ring?

(ring/run-jetty
 (var app)
 {:port port :join? false
  :headerbuffersize 1048576})

What is the right way to do this?

Thanks!

prismofeverything
  • 8,799
  • 8
  • 38
  • 53

1 Answers1

9

I think this should work:

(def header-buffer-size 1048576)

(def config
  {:host  "example.com"
   :port  8080
   ; join? false ; and any other options...
   :configurator (fn [jetty]
                   (doseq [connector (.getConnectors jetty)]
                     (.setHeaderBufferSize connector
                                           header-buffer-size)))
   })
Michał Marczyk
  • 83,634
  • 13
  • 201
  • 212
  • That most certainly does work! I see now, with a reference to jetty we can do whatever configuration we need. Thanks! – prismofeverything Feb 15 '12 at 04:58
  • Someone stated that in recent versions of jetty you should use `setRequestHeaderSize` instead of `setHeaderBufferSize`. If that is the case, feel free to include this information as an addendum. – stealthjong Aug 01 '14 at 10:18