SSL Certificate for Http Request [GOT CREATED]

There is any way to use certificates to make Http requests with this node?

like we can do in Postman certificates option.

Currently that is no possible. You can make a feature request.

Hey @rodrigoscdc!

I’ve turned this into a feature request. Don’t forget to vote it :slight_smile:

Hi, harshil, i have the same problem. I use a nginx proxy on the same server for that that works.
https://serverfault.com/questions/622855/nginx-proxy-to-back-end-with-ssl-client-certificate-authentication

Thanks,
Stefan

1 Like

Hello, any update about this feature? Is it in your roadmap of development?

1 Like

I do not think so but not completely sure. @David has a better view of what is on our internal roadmap. Perhaps, this is something we add to the HTTP node V2 which is probably somewhere in our roadmap.

Just for future reference, we probably have to set the agentOptions to achieve this.

@sirdavidoff Do you have any update if this feature request is in your scope of development?
Thanks for your attention.

3 Likes

I am very interested in this feature and have already voted on the feature request.

Here in Brazil, open banking is being implemented and there is a bank that has provided api that requires access with crt and key.

2 Likes

We’re going to tackle the HTTP node once we have the public API out, at which point we’ll take a decision on this. But can very much see why it would be useful.

2 Likes

In my case, it will be very useful to access the government soap apis from here. I’m an accountant, and through that I could integrate these requests from my clients through n8n, and a .pfx certification is required.

1 Like

This will be an important feture for the Cloud vertion too

1 Like

Voted!
We think this feature will be very interesting also for n8n cloud as there are other solutions that already have it. aka make.com (integromat.com). Examples below.

It is interesting the way the handle the cert and key files. They have a helper, that extracts the key which is what actually gets saved in the credentials module.

Now, to be able to use it in the meantime, some post above suggests to import using npm request (request - npm) but I see this is deprecated. Any idea on new npm option that is not deprecated? @RicardoE105

Thanks!
Andres

1 Like

Hey @pradilla,

You could use Axios and pass it a nodejs https.agent that is configured to use a cert and key.

Great @Jon !!! Any chance you can share just a short snippet or workflow node code to copy and paste with an example please?

Also. I can use this on one of my hosted n8n, but would really need it in my cloud version. So, can the axios lib be added to cloud? same as you guys added the crypto one? @maxT

Found this, can any of you guys help me modify to fit n8n function syntax and return the json body?
Thanks in advance!! =)

const agent = new https.Agent({
key: fs.readFileSync(__dirname + ā€˜/path/to/keyfile.key’),
cert: fs.readFileSync(__dirname + ā€˜/path/to/certfile.cert’),
rejectUnauthorized: false
keepAlive: true
});

const data = JSON.stringify({
…
});

const axiosConfig = {
httpsAgent: agent,
headers: {
ā€˜Content-Type’: ā€˜application/json’,
ā€˜Content-Length’: data.length,
}
};

const response = await axios.post(ā€˜https://someendpoint’, data, axiosConfig).then(r => {
console.log(ā€˜r’, r);
})

1 Like

n8n functions use JavaScript so what you have would in theory work if the paths are valid. You might need to pop in a couple of require lines to use the Axios config and https agent, when trying to run it you should get some errors that would help adapt it as needed.

Got it working!
Thanks!

Needed these 3 modules and for now can not run on n8n cloud (https,axios,fs). If any ideas arise these would be more than welcome. @Jon @maxT

const https = require(ā€˜https’)
const axios = require(ā€˜axios’);
const fs = require(ā€˜fs’);

Running axios like this:
const response = await axios(options)
Then in the options new Agent like this:
httpsAgent : new https.Agent(agent),
And the cert files pulled from local storage like this (documentation does say it can be a path or a URL:
ā€œkeyfileā€: fs.readFileSync(ā€˜path/keyfile.key’),

3 Likes

Hi All:
I woud like to resume about this topic: SSL Certificate for HTTP Request on Cloud Vertion.

I’m not sure if In this post we have all the elements about the relevance, oportunities and possible approaches to send to de Product Team for their estimates. But one thing I’m sure is that this feature will add big value for the Cloud Vertion.

#cloud #feature-requests #security

I want to add SSL Certificate for Http Request on Cloud Version

Hey Guys.
For all people following this topic SSL Certificates for Http Request on Cloud Vertion, this guy @pradilla is showing us a very nice /affordable way to implement it as an extension of current Oauth2 module bypassing the files handling in a clever way .
Let’s check it : HTTP with client certificate auth request

With this… my hope for christmas :gift: :santa: is to see this topic climbing to the top of the backlog tree :christmas_tree: :rofl:
#cloud #feature-requests #core #security

1 Like

Hey @maxT, hope all is well! I just wanted to come here and see if there can be some traction with this FR that has 16 votes. some time back I got an answer from Ricardo who understood that this should not be so difficult. Placing that thread here for reference: HTTP with client certificate auth request - Questions - n8n @Jose_Alejandro_Diaz1

Thanks,
Andres

1 Like