Skip to content

Commit f15e164

Browse files
APM-6214 sonar restrict cors
1 parent 6d59bab commit f15e164

File tree

1 file changed

+17
-1
lines changed
  • docker/hello-world-sandbox/src

1 file changed

+17
-1
lines changed

docker/hello-world-sandbox/src/app.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,23 @@ const cors = require('cors');
33

44
const app = express();
55
app.disable("x-powered-by");
6-
app.use(cors());
6+
7+
const corsOptions = {
8+
origin: 'https://digital.nhs.uk',
9+
allowedHeaders: [
10+
'origin',
11+
'x-requested-with',
12+
'accept',
13+
'content-type',
14+
'Authorization',
15+
'apikey'
16+
],
17+
maxAge: 3628800,
18+
methods: ['GET', 'PUT', 'POST', 'DELETE']
19+
};
20+
21+
22+
app.use(cors(corsOptions));
723

824
const PORT = process.env.PORT || 9000;
925

0 commit comments

Comments
 (0)