title: Flask file upload limit
body: <p>I have a file upload handler for multiple file uploads, and have set the MAX_CONTENT_SIZE. The docs mention that Flask throws a 413 exception when the total file size exceeds the limit, so I've also written a 413 error handler with a custom 413 page. However, when testing the file upload, I can see that the 413 error is definitely thrown, but the connection seems to break everytime instead of rendering my error page. FYI, I'm using the Flask dev server currently.</p>
  
  <p>Code:</p>
  
  <pre><code>app.config['MAX_CONTENT_LENGTH'] = 50 * 1024 * 1024    # 50 Mb limit
  
  @app.route('/upload', methods=['POST'])
  def upload_files():
      if request.method == 'POST':
         uploaded_files = request.files.getlist('uploaded_files[]')
  
         # do some stuff with these files
  
  
  
  @app.errorhandler(413)
  def error413(e):
      return render_template('413.html'), 413
  </code></pre>
  
  <p>UPDATE:</p>
  
  <p>Ok strange, this problem seems to only occur when using the Flask dev server. I'm testing it on Apache, and my 413 error page renders fine.</p>