Skip to content

Commit 81d8558

Browse files
committed
Added header to calls to flood warning API.
1 parent 76cce47 commit 81d8558

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

server/util.js

+15-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const FETCH_ERROR_MSG = 'Requested resource returned a non 200 status code'
44

55
const config = require('./config')
66
const wreck = require('@hapi/wreck').defaults({
7-
timeout: config.httpTimeoutMs
7+
// timeout: config.httpTimeoutMs
88
})
99
let wreckExt
1010

@@ -16,9 +16,15 @@ if (config.http_proxy) {
1616
}
1717

1818
const { performance } = require('node:perf_hooks')
19-
const get = (url, options, ext = false) => {
19+
const get = (url, options = {}, ext = false) => {
2020
const thisWreck = (ext && wreckExt) ? wreckExt : wreck
2121
const startTick = performance.now()
22+
// Header with UA added for AWS WAF as it is required
23+
options.headers = {
24+
...options.headers,
25+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3'
26+
}
27+
2228
return thisWreck.get(url, options)
2329
.then(response => {
2430
if (config.performanceLogging) {
@@ -38,9 +44,15 @@ const get = (url, options, ext = false) => {
3844
})
3945
}
4046

41-
const post = (url, options, ext = false) => {
47+
const post = (url, options = {}, ext = false) => {
4248
const thisWreck = (ext && wreckExt) ? wreckExt : wreck
4349
const startTick = performance.now()
50+
// Header with UA added for AWS WAF as it is required
51+
options.headers = {
52+
...options.headers,
53+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3'
54+
}
55+
4456
return thisWreck.post(url, options)
4557
.then(response => {
4658
if (config.performanceLogging) {

0 commit comments

Comments
 (0)