The header contains invalid characters
See original GitHub issueEdit: Found the problem! https://github.com/koajs/generic-session/issues/96#issuecomment-234743407
When running:
this.session.count = 12
This exception gets thrown:
koa-generic-session set error: The header content contains invalid characters
at ServerResponse.OutgoingMessage.setHeader (_http_outgoing.js:351:13)
at Cookies.set (..project\node_modules\cookies\lib\cookies.js:100:13)
at Object.options.sessionIdStore.set (..project\node_modules\koa-generic-session\lib\session.js:93:20)
at Object.saveNow (..project\node_modules\koa-generic-session\lib\session.js:283:26)
at next (native)
at onFulfilled (..project\node_modules\co\index.js:65:19)
at process._tickCallback (node.js:369:9)
These are the modules that I used:
koa v1.2.0
koa-generic-session v1.11.1
koa-router v5.4.0
Can be reproduced with the following application:
'use strict'
const koa = require('koa')
const router = require('koa-router')()
const session = require('koa-generic-session')
const app = koa()
app.keys = ['key']
app.use(session())
router.get('/', function* () {
this.session.count = 12
this.body = 'test'
});
app.use(router.routes())
app.listen(3000)
console.log('listening on port 3000')
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
TypeError: The header content contains invalid characters
When i try run this function, my console throw me this type of error: TypeError: The header content contains invalid characters.
Read more >Response header name ' ' contains invalid characters ... - IBM
Host: headers with invalid hostnames A "name" (Net, Host, Gateway, or Domain name) is a text string up to 24 characters drawn from...
Read more >The header content contains invalid characters #34 - GitHub
This error is typically accurate, meaning that the headers have invalid characters somewhere in them. Can you make sure that your "logdna key" ......
Read more >Response header name ' file' contains invalid characters ...
On the hosting, there is an error in the logs: AH02429: Response header name ' file' contains invalid characters, aborting request, referer.
Read more >Header Process instance id contains invalid character
Hi, I am getting below error when I receive the response. Is this because of some header in the response? I am not...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Looks like that it was a issue with the newer versions of node. It works fine with version 4.2.6 of node.
It might be worth checking out this change https://github.com/nodejs/node/commit/cf2b714b02 to add support for newer versions of node.
Edit: As a temporary solution you can run the node application with
--security-revert=CVE-2016-2216
Updating koa to version 1.2.1 and koa-generic-session to version 1.11.3 fixed it.