File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33 < head >
44 < meta charset ="UTF-8 " />
55 < meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
6+ <!-- Add Security Headers -->
7+ < meta http-equiv ="Content-Security-Policy "
8+ content ="default-src 'self'; connect-src 'self' https://api.ipify.org https://dns.google; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; ">
9+ < meta http-equiv ="X-Frame-Options "
10+ content ="SAMEORIGIN ">
11+ < meta http-equiv ="X-Content-Type-Options "
12+ content ="nosniff ">
13+ < meta name ="referrer "
14+ content ="strict-origin-when-cross-origin ">
615 < title > Tool Dashboard</ title >
716 < link rel ="stylesheet " href ="styles.css " />
817 </ head >
Original file line number Diff line number Diff line change 1+ const express = require ( 'express' ) ;
2+ const path = require ( 'path' ) ;
3+ const app = express ( ) ;
4+
5+ app . use ( ( req , res , next ) => {
6+ // Security Headers
7+ res . setHeader ( 'Content-Security-Policy' , "default-src 'self'; connect-src 'self' https://api.ipify.org https://dns.google; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'" ) ;
8+ res . setHeader ( 'X-Frame-Options' , 'SAMEORIGIN' ) ;
9+ res . setHeader ( 'X-Content-Type-Options' , 'nosniff' ) ;
10+ res . setHeader ( 'Referrer-Policy' , 'strict-origin-when-cross-origin' ) ;
11+ next ( ) ;
12+ } ) ;
13+
14+ app . use ( express . static ( path . join ( __dirname ) ) ) ;
15+
16+ const PORT = 3000 ;
17+ app . listen ( PORT , ( ) => {
18+ console . log ( `Server running at http://localhost:${ PORT } ` ) ;
19+ } ) ;
You can’t perform that action at this time.
0 commit comments