-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
is there a way to add maxHeaderSize to HTTPS server #3401
Comments
@nodejs/http |
This should be possible as the whole machinery is the same. It probably needs some additional documentation fix. |
Hi @gireeshpunathil. I've tried across different Node version. The problem exists only for Node 12, while it is fixed on 14 and 16. If you look at the documentation and its history, you will notice that For anybody else interested in reproducing the issue, you can use code below: import { readFileSync } from 'fs'
import { createServer } from 'https'
import undici from 'undici'
const server = createServer(
{
key: readFileSync('ssl/privkey.pem'),
cert: readFileSync('ssl/fullchain.pem'),
maxHeaderSize: 8192 * 6
},
(req, res) => {
res.writeHead(200)
res.end(`X-Payload header size: ${req.headers['x-payload'].length}`)
}
).listen(0, async () => {
const port = server.address().port
console.log(`Server is listening on port ${port} using Node ${process.version} ...`)
const payload = Buffer.alloc(8192 * 5, '123').toString('utf-8')
const {
statusCode,
headers,
body: data
} = await undici.request(`https://home.cowtech.it:${port}`, {
headers: { 'x-payload': payload },
dispatcher: new undici.Agent({ pipelining: 0 })
})
let body = Buffer.alloc(0)
for await (const chunk of data) {
body = Buffer.concat([body, chunk])
}
console.log('Received reply:\n\n' + JSON.stringify({ statusCode, headers, body: body.toString('utf-8') }, null, 2))
server.close()
}) |
Hi Team,
I would like to know if it is possible to set
maxHeaderSize
option to the HTTPS server. Out of the box HTTPS module does not have this option, and I am wondering if there is way to do so. The problem I have is, the server throws 431 error response due to the large header size in the incoming request to the HTTPS server.Is there a solution to my problem? It must be a common problem, but I could not find anyone reporting it anywhere. It seems (according to the documentation) the options of HTTP server are applicable to HTTPS, but the value does not seem to work in my case (seeing 431 error always). How can I verify the maxHeaderSize value using HTTPS server. My code looks like -
The text was updated successfully, but these errors were encountered: