Software Snippets #1
client_max_body_size in nginx
Thought I'd use this blog to note down interesting bite-sized things I come across during dev that I may want to refer back to at some point.
While copy-pasting images for my previous post, I kept getting a "413 Content Too Large" error from nginx. Turns out the default max content size you can post is one megabyte. Fortunately, the solution is simple:
location /target/path {
...
client_max_body_size 10M;
}
Obviously, replace the path and the property value with whatever you need.
Worth noting that this is one of those nginx properties that cannot take a variable as a value, so you cannot set up a map for it that returns different sizes based on URI.