On windows I found corsproxy files to hack:
C:\Users\rjmetcal\AppData\Roaming\npm\node_modules\corsproxy-https
Running for particular server URL
I made a bat file called 'rjmcorsproxy' as follows:
-
set CORSPROXY_HOST=cc-rjmetcal
-
corsproxy
Hack of corsproxy-https to ignore cert errors
Edit C:\Users\rjmetcal\AppData\Roaming\npm\node_modules\corsproxy-https\bin\corsproxy
In proxy.route add rejectUnauthorized: false
-
proxy.route({
-
method: '*',
-
path: '/{host}/{path*}',
-
handler: {
-
proxy: {
-
passThrough: true,
-
rejectUnauthorized: false,
-
mapUri: function (request, callback) {
-
request.host = request.params.host
-
request.path = request.path.substr(request.params.host.length + 1)
-
request.headers['host'] = request.host
-
var query = request.url.search ? request.url.search : ''
-
var scheme = request.url.scheme
-
console.log('proxy to https://' + request.host + request.path)
-
callback(null, 'https://' + request.host + request.path + query, request.headers)
-
}
-
}
-
},
-
config: {
-
payload: {
-
maxBytes: maxPayload
-
}
-
}
-
})
RJM Article Type
Work Notes