Can you set the size limit of a post request in header?

扶醉桌前 提交于 2020-01-15 11:30:07

问题


I'm trying to make a post request to my noir server but I have too many parameters and the server just responds with 413 status code. I was wondering if I could raise the character limit for the post request. I read it's possible with other services like What is the size limit of a post request? and Clojure/Ring: Using the ring jetty adapter, large requests give me a 413: FULL HEAD error.

Thanks!


回答1:


noir.server/start accepts a map of options as a second argument (which is itself optional). If this map contains an entry with a key of :jetty-options, the value at that key is passed as the options argument to ring.adapter.jetty/run-jetty.

So, you can say something like

(server/start 8080 {:jetty-options {:configurator ...}})

where the value at the :configurator key is as described in my answer to the Clojure/Ring: Using the ring jetty adapter, large requests give me a 413: FULL HEAD error. question you link to:

;;; reproducing here for convenience
(fn [jetty]
  (doseq [connector (.getConnectors jetty)]
    (.setHeaderBufferSize connector header-buffer-size)))

(header-buffer-size being the name of a Var storing a value you're happy with).



来源:https://stackoverflow.com/questions/18093392/can-you-set-the-size-limit-of-a-post-request-in-header

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