How to reach rest api via proxy by using cURL in eventing function

How to pass Proxy url and proxy port to reach external API from eventing function?

To elaborate more using URL Alias from Bindings to pass the domain name like https://example.com/api

and using below code for calling external URL
var request = {
headers: {
‘Content-Type’: ‘application/json’
},
body: {
“xx”: “yy”
}
};
var response = curl(‘POST’, Rest_Url, request);

where Rest_Url is the binding url (https://example.com/api)

now the Eventing node is behind the proxy how to pass the poxy url and proxy port while calling Rest_Url here ?

@jon.strabala , any clue ?

Without seeing your binding or knowing about you you proxy setup and having actaul URL http v https it is hard to advise. If I assume you are going to https://example.com/api we definitely have a TLS connection.

Now in basic curl I think you would need to do

curl -k -x http://myproxy.com:8080 \
    -X POST https://example.com/api \
   -H "Content-Type: application/json" \
   -d '{"xx": "yy"}'

where
-x or --proxy: Specifies the proxy server you want to use.
-k allows connect without verifying the SSL certificate

I am thinking you need to use URL rewriting at your proxy, but I will do further research.

@surya,

I’m sorry but Eventing can not natively support a proxy, you will need an external module or more heavy weight a use webserver like nginx in a reverse proxy. We have opened an improvement ticket.

However if you ask your direct sales / field support channel to open a CBSE requesting this feature “Proxy support for Eventing” it will help prioritize implementation and release of the feature.

Best

Jon Strabala
Principal Product Manager - Server‌

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.