【发布时间】:2018-12-05 21:22:20
【问题描述】:
我正在尝试在 express.js 中处理带有大参数的 GET 请求。 我正在使用 express 4.14.0 的 docker 容器中运行节点 8 'carbon'。
requestURI 总共有 9971 个字节。
例如http://somedomain.com/path?param1=dfsgbdg¶m2=verrylargeparam
卷曲响应: curl: (52) 来自服务器的空回复
如果我将大小减小到 8k 以下,一切都很好。
node 或 express 是否存在可以解释这种行为的硬性限制? 我可以提高限额吗? (不是正文,requestURI) 我需要切换到 POST 吗?
提前致谢
c
这是我的流派设置
let router = express();
var bodyParser = require('body-parser');
app.use(bodyParser.json({limit: '50mb'}));
app.use(bodyParser.urlencoded({limit: '50mb', extended: true, parameterLimit: 10000000000}));
router.use(compression());
router.use(function (req, res, next) {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Headers', 'X-Requested-With');
res.header('Access-Control-Allow-Headers', 'Content-type');
res.header('Access-Control-Allow-Methods', 'GET,POST,OPTIONS');
next();
});
router.get('/my/get/route', myExecFunction);
router.use(another);
router.use(another);
router.use(another);
router.use(another);
router.use(another);
router.use(another);
router.use(another);
router.use(another);
router.use(another);
router.enable('trust proxy');
router.listen(process.env.HTTP_PORT);
logger.info(`Running on http://localhost:${process.env.HTTP_PORT}`);
export default router;
【问题讨论】: