File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ unreleased
2+ ==========
3+
4+ * Set default CSP header in redirect response
5+
161.11.2 / 2017-01-23
27===================
38
Original file line number Diff line number Diff line change @@ -181,6 +181,7 @@ function createRedirectDirectoryListener () {
181181 res . statusCode = 301
182182 res . setHeader ( 'Content-Type' , 'text/html; charset=UTF-8' )
183183 res . setHeader ( 'Content-Length' , Buffer . byteLength ( msg ) )
184+ res . setHeader ( 'Content-Security-Policy' , "default-src 'self'" )
184185 res . setHeader ( 'X-Content-Type-Options' , 'nosniff' )
185186 res . setHeader ( 'Location' , loc )
186187 res . end ( msg )
Original file line number Diff line number Diff line change @@ -476,6 +476,13 @@ describe('serveStatic()', function () {
476476 . expect ( 301 , 'Redirecting to <a href="/snow%20%E2%98%83/">/snow%20%E2%98%83/</a>\n' , done )
477477 } )
478478
479+ it ( 'should respond with default Content-Security-Policy' , function ( done ) {
480+ request ( server )
481+ . get ( '/users' )
482+ . expect ( 'Content-Security-Policy' , "default-src 'self'" )
483+ . expect ( 301 , done )
484+ } )
485+
479486 it ( 'should not redirect incorrectly' , function ( done ) {
480487 request ( server )
481488 . get ( '/' )
You can’t perform that action at this time.
0 commit comments