I have a single page project,
I wanted to submit the form but receiving the 431 (Request Header Fields Too Large) error when my axios request attempts to run.
Not sure what else to try, so if someone has any suggestions, that would be fantastic!
Things I've tried:
set maxContentLength and maxBodyLength to Infinity,
added max-http-header-size
Where config is:
axios({
method: 'post',
url: 'http://example.com',
params: {a:b},
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}).then(function (response) {
console.log(response)
}).catch(function (error) {
console.log(error)
})
When the params content length is small, it works.
Howerver,when the params content length is too big(like 14kb) ,
it received 431 error(Request Header Fields Too Large)
And the complete URL looks like:
http://localhost:9527/console/article/update?id=24321&title=%E5%8F%82%E4%B8%8E%E6%A0%87%E9%A2%9819000000061&image[]=&browseNumber=0&likeNum=1&shareNum=0&type=2&aspectType=0&status=1&userId=21334&admin=LZ000001&descStr=%E5%8F%82%E4%B8%8E%E5%86%85%E5%AE%B919000000061&roof=0&commodityIds[]=41&examine=1&htmlUrl=http:%2F%2Flocalhost:8080%2Fstatic%2Fhtml%2Fatlas%2B24321.html&isDel=0&sortNum=0&sortNo=0&createTime=2020-11-04+12:04:10&activityId=3&userNickName=iVQH4763&article=%3Cp%3E%E5%8F%82%E4%B8%8E%E5%86%85%E5%AE%B919000000061%3C%2Fp%3E&isLike=0&labelIds[]=8
I suppose the error is caused by the too big parameter content of the url.
And I cant't figur out the way to config this correct.
Any help would be greatly appreciated. Thank you!
question from:
https://stackoverflow.com/questions/65557444/axios-post-request-throws-431-error-after-submit 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…