您可以在标题中设置帖子请求的大小限制吗? [英] Can you set the size limit of a post request in header?
问题描述
我试图向我的noir服务器发送一个post请求,但是我的参数太多,服务器只响应了413状态码。我想知道我是否可以提高字符限制的post请求。我读过它可能与其他服务,如什么是帖子请求的大小限制?和
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.
推荐答案
noir.server / start
选项作为第二个参数(它本身是可选的)。如果此映射包含键为:jetty-options
的条目,则该键的值作为options参数传递给 ring.adapter。 jetty / run-jetty
。
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
.
因此,你可以说
(server/start 8080 {:jetty-options {:configurator ...}})
其中:configurator
键的值如我在回答 Clojure / Ring:使用ring jetty适配器,大请求给我一个413 :FULL HEAD错误您链接到的问题:
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
是存储值的Var的名称你很高兴)。
(header-buffer-size
being the name of a Var storing a value you're happy with).
这篇关于您可以在标题中设置帖子请求的大小限制吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!