Error 413 (Request Entity Too Large)

Hey all,

Desperately need some help here.
I built an application that allows users to select and plot large sets of data. I have a callback that is triggered on a chart relayout (Input(‘chart’, ‘relayoutData’)) and takes in the chart figure as a state (State(‘chart’, ‘figure’)) so that I don’t have to make subsequent api calls for the same data.

The problem I’m running into is when the chart’s layout changes, and the callback is triggered, I get a 413 error. I understand that this error is generated because I’m trying to pass a large amount of data (~2MB) back to the server in the chart’s figure object. However, I don’t know how to fix the error. The flask documentation (here) recommends increasing the max content length via the following code:

from flask import Flask, Request
app = Flask(name)
app.config[‘MAX_CONTENT_LENGTH’] = 16 * 1024 * 1024

but that didn’t remedy the issue. Any other thoughts? Also, the app was working perfectly until I repackaged and redeployed the code today. Any ideas why this suddenly became an issue? Thought it might be a chrome thing, but I get the same result in internet explorer.

Thanks in advance for your help.

Are you running locally, or in a production environment? Are you using nginx or similar?

@Emil I tested both locally and in a production environment (using waitress and the default flask server). I only get the error in the production environment though. Running locally works just fine.

Thanks for your help.