-
Notifications
You must be signed in to change notification settings - Fork 520
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adjusting the max POST body size #228
Comments
You might be able to set this via (run-jetty
handler
{:port 3000
:configurator #(.setAttribute % "org.eclipse.jetty.server.Request.maxFormContentSize" -1)}) Let me know if that works. |
@weavejester Thanks. I tried this but it did not affect the behavior of the server. I think the From Jetty 7.6 Java Docs
Do you know if Ring uses a Context handler by default, and if so where to get it? |
Unfortunately I don't know. Jetty is labyrinthine in its class structure, and none of it is documented beyond a minimal set of Javadocs. I tried to figure out where the ContextHandler is introduced, but I think it'll require a significant investment of time going through the source code. Also, the Jetty version is 9, so the Jetty 7.6 docs you have might be outdated. |
Perhaps the best option is simply to use another adapter, like Ring-Undertow or Http-Kit. It's a bit of a cop-out, but it might save you time in the long run. |
@weavejester Thank you. I was lost in Jetty Docs and source code as well. I am thinking to change the adaptor to http-kit as it allows to explicitly set |
@namooh How do you know this is the right approach? What did you see that led you to this being the knob that needed to be adjusted? I ask because from my reading of the Jetty docs and examples, I don't think Jetty is introducing a (let [server (create-server (dissoc options :configurator))
proxyf (if (:async? options) async-proxy-handler proxy-handler)
context-handler (ContextHandler. (proxyf handler))]
(when-let [max-form-content-size (:max-form-content-size options)]
(.maxFormContentSize context-handler max-form-content-size))
(.setHandler server context-handler)
(when-let [configurator (:configurator options)]
(configurator server))
(try
(.start server)
(when (:join? options true)
(.join server))
server
(catch Exception ex
(.stop server)
(throw ex)))) Note: the above is completely untested, but seems to be what is suggested by the Jetty docs (though we may have to set a prefix too). This is what I'm basing this on: https://www.eclipse.org/jetty/documentation/9.3.x/embedding-jetty.html#_embedding_contexts But, I'm not convinced that it's a |
I would like to adjust the POST max body size for my server, as 200KB default is pretty low for my use case. I have found the solution to modify the jetty server: https://wiki.eclipse.org/Jetty/Howto/Configure_Form_Size
The solution is basically to set the system property
org.eclipse.jetty.server.Request.maxFormContentSize
. This can be done in leiningen easily, but is not very production friendly.Is there anyway to set this property in Ring? It would be great if
run-jetty
function accepts the argument above.The text was updated successfully, but these errors were encountered: