10
votes

stack: flask 0.10 + uwsgi 1.4.5 + nginx 1.2.3

I can upload small files (<100k) through my application but larger ones fail. uwsgi log shows:

Invalid (too big) CONTENT_LENGTH. skip.

nginx log does not show anything useful.

I tried the following, without success:

  • [nginx conf] client_max_body_size 0 or 20M
  • [uwsgi conf] limit-post: 0 or 20000000
  • [flask conf] MAX_CONTENT_LENGTH = 20000000

So my questions:

  1. Is there a conf somewhere else i can change?
  2. Is there a way of verifying the used options at runtime on uwsgi/nginx?
1
thanks to whoever suggested adding the MAX_CONTENT_LENGTH to Flask (and deleted the answer), i tried it, but it didn't help - Jeroen Dierckx
That's, why I deleted it. Look at uwsgi source. It contains your error message. So I am pretty sure that limit-post isn't updated. Are you restart urwsgi ? Also check other uwsgi configs, maybe they contains limit-post to. - Slava Bacherikov
As you can see from uwsgi source: if no limit-post, then post size isn't limited in uwsgi. Check uwsgi process. On debian /usr/share/uwsgi/conf/default.ini are also loaded with application config. - Slava Bacherikov
Yes, i did restart every time. I found the line in the uwsgi source as well, that's how i came to the limit stuff ;). Anyway, i checked for limit-post in all the confs, and ... you were right; the value was overwritten by another conf file. Thanks a lot for helping me debug. If you suggest it in an answer here, i'll accept it. - Jeroen Dierckx

1 Answers

9
votes

Your problem in uwsgi limit-post params. Look at source. This variable can be overridden by other configs. For example on debian config from /usr/share/uwsgi/conf/default.ini are also loaded.