问题
I'm storing images in fabric blockchain as base64 strings. Here, whenever I try to interact(update or add assets including base64 strings) with the blockchain through the composer rest server, it throws below error,
Error: request entity too large
How to increase the request size limit or what are other possible approaches to handle this issue?
回答1:
I was able to edit the maximum request size of the REST server by editing the server.js
located in path_to_rest_server/server/
. I edited below code,
// Support JSON encoded bodies.
app.middleware('parse', bodyParser.json());
// Support URL encoded bodies.
app.middleware('parse', bodyParser.urlencoded({
extended: true,
}));
to,
// Support JSON encoded bodies.
app.middleware('parse', bodyParser.json({
strict: false,
limit: "10000kb"
}));
// Support URL encoded bodies.
app.middleware('parse', bodyParser.urlencoded({
extended: true,
limit: "10000kb"
}));
10000kb
is the size limit.
来源:https://stackoverflow.com/questions/52238352/composer-rest-server-entity-too-large