Connect to external proxy AND ignore SSL errors

I'm trying to connect to an external proxy via workers and the proxy requires me to ignore SSL errors. I'm including the customer support response from the proxy server owner and I'm including two examples in Shell and using a request-promise package. Notice the -k flag in Shell and "rejectUnauthorized: false" in the request-promise package. I'm trying to do the equivalent in a library that is supported by Workers. Any ideas or workarounds? Support response: "You would need to add the equivalent of the "-k" to your JS code in order for the WU to work properly. You can find an example of how to do that in the CP, however, we currently only have examples for Axios and request-promise, which are not the libraries you are using. In those examples, you can see that "rejectUnauthorized: false" was added as a parameter to the request in order to ignore SSL errors. Please add your library's version of "rejectUnauthorized: false", or ignore SSL errors in another way (process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0", for example)." Examples: Shell: #!/bin/bash USERNAME={username} PASSWORD={password} PORT=22225 SESSION=$RANDOM curl --proxy brd.superproxy.io:$PORT \ --proxy-user $USERNAME-session-$SESSION:$PASSWORD \ -k "http://lumtest.com/myip.json" request-promise package: #!/usr/bin/env node /This sample code assumes the request-promise package is installed. If it is not installed run: "npm install request-promise"/ var request = require('request-promise'); var username = {username}; var password = {password}; var port = 22225; var session_id = (1000000 * Math.random())|0; var super_proxy = 'http://'+username+'-session-'+session_id+':'+password+'@brd.superproxy.io:'+port; var options = { url: 'http://lumtest.com/myip.json', proxy: super_proxy, rejectUnauthorized: false }; request(options) .then(function(data){ console.log(data); }, function(err){ console.error(err); });
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server