Clojure/Ring: Using the ring jetty adapter, large requests give me a 413: FULL HEAD error.

会有一股神秘感。 提交于 2019-12-05 02:05:36

问题


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!


回答1:


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)))
   })


来源:https://stackoverflow.com/questions/9285096/clojure-ring-using-the-ring-jetty-adapter-large-requests-give-me-a-413-full-h

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!