It would help if there was a node for:
http request node
My use case:
When I call rest api
origin : http
proxy : http
destination : https
then I can see the below error log
Handshake failed The SSL handshake could not be performed. Host: www.lens.org
Reason: Can’t initialize server context:handshakefailed:server state 1:state 9:Application response 500 handshakefailed
Any resources to support this?
Problem is because I tried to call rest api from http(proxy) to https(destination)
I solve this problem using TunnelAgent.httpsOverHttp like the below code
const axios = require(‘axios’);
const TunnelAgent = require(‘tunnel’);
const url = require(‘url’);
const fs = require(‘fs’);
// Retrieve proxy from environment variables
const proxyUrl = process.env.http_proxy || process.env.https_proxy;
if (!proxyUrl) {
console.error(“Error: No proxy URL found in environment variables.”);
process.exit(1);
}
// Parse proxy URL
const parsedProxyUrl = url.parse(proxyUrl);
// Configure the proxy agent
const proxyAgent = TunnelAgent.httpsOverHttp({
proxy: {
host: parsedProxyUrl.hostname, // Proxy host
port: parseInt(parsedProxyUrl.port, 10), // Proxy port (converted to an integer)
},
ca: fs.readFileSync(‘/path/to/ca.pem’), // Path to the trusted CA certificate
});
// Define request options
const options = {
url: ‘https://www.lens.org’, // Target URL
method: ‘GET’, // HTTP method
headers: {
‘User-Agent’: ‘curl/7.68.0’, // Set User-Agent to match curl
‘Accept’: ‘/’, // Accept all content types
},
httpsAgent: proxyAgent, // Use the configured proxy agent
proxy: false, // Disable Axios default proxy handling
};
Are you willing to work on this?
If you give me guide to contribute this changes to n8n github code,
I can fix this issue on the http request node