diff options
author | Chocobozzz <me@florianbigard.com> | 2022-07-18 15:41:47 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-07-18 15:41:47 +0200 |
commit | cace0d1a71c266b0b60c159f0ed08011f40ad951 (patch) | |
tree | e402679d79fa3b30072d09c683e8b559bb5911c5 /server | |
parent | ace01da3480e0de943cb028f9541790e0a015eb4 (diff) | |
download | PeerTube-cace0d1a71c266b0b60c159f0ed08011f40ad951.tar.gz PeerTube-cace0d1a71c266b0b60c159f0ed08011f40ad951.tar.zst PeerTube-cace0d1a71c266b0b60c159f0ed08011f40ad951.zip |
Prevent headers sent error
Diffstat (limited to 'server')
-rw-r--r-- | server/middlewares/dnt.ts | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/server/middlewares/dnt.ts b/server/middlewares/dnt.ts index dd88005dd..a128aadf7 100644 --- a/server/middlewares/dnt.ts +++ b/server/middlewares/dnt.ts | |||
@@ -1,5 +1,10 @@ | |||
1 | const advertiseDoNotTrack = (_, res, next) => { | 1 | import * as express from 'express' |
2 | res.setHeader('Tk', 'N') | 2 | |
3 | const advertiseDoNotTrack = (_, res: express.Response, next: express.NextFunction) => { | ||
4 | if (!res.headersSent) { | ||
5 | res.setHeader('Tk', 'N') | ||
6 | } | ||
7 | |||
3 | return next() | 8 | return next() |
4 | } | 9 | } |
5 | 10 | ||