Forward Proxy configuration in bubble plugin

Hello folks, am quite new to bubble plugin development. I want to implement a forward proxy in bubble to redact sensitive data. I have the following code which is running okay, sending requests to tatum.io. I want to pass the requests through VGS which offers proxy services.
This is the nodeJS code I want to implement in the plugin. Any help would be highly appreciated.

const fs = require('fs');

const request = require(‘axios’);
const tunnel = require(‘tunnel’);

async function getData() {
const tunnelingAgent = tunnel.httpsOverHttp({
ca: [ fs.readFileSync(‘path/to/sandbox.pem’)],
proxy: {
host: ‘tntsfeqzp4a.sandbox.verygoodproxy.com’,
port: ‘8080’,
proxyAuth: ‘USiyQvWcT7wcpy8gvFb1GVmz:2b48a642-615a-4b3c-8db5-e02a88147174’
}
});

const redactedPayload = {
account_number: ‘tok_sandbox_w8CBfH8vyYL2xWSmMWe3Ds’,
};

return await request.post(
https://echo.apps.verygood.systems/post’,
JSON.stringify(redactedPayload),
{
httpsAgent: tunnelingAgent,
proxy: false,
headers: {
‘Content-Type’:‘application/json’
}
}).then((r) => {
console.log(’\nResponse from Axios request on REVEAL:’);
console.log(r.data);
return r.data;
});
}

1 Like

This looks pretty cool, @collins. Did you get it to work? How do you like VGS?

VGS is super awesome, I was never able to accomplish that in bubble so I followed a different approach using AWS Lambda.

1 Like

@collins hello there !
I’m trying to use SQL with my personal app on bubble. Im trying to figure out how to use AWS lambda to whitelist ip. Do you have a link or ressources to help me ? thank s!

Hello @Alter345 , What exactly are you trying to achieve? Pass data from bubble to a SQL database like DynamoDB in AWS and that would be through the API gateway then you can trigger the data load via AWS Lambda. You can then setup an IAM policy in AWS to whitelist the IP interacting with API gateway.

Is this the case? If not please gimme more details I’ll be glad to help.

@collins thanks for your time.
What i’m trying to accomplish is to use a SQL database (on AWS RDS) instead of bubble’s data base.
I did it using the mysql connector - it works just fine.
However, after reading some thread, if i’m understanding well, opening the IP adress to get bubbles datas is not safe.
Some people told me to use a dedicated plan to get a dedicated IP which i cannot do since i do not have the budget to do it.
Some people told me it is doable with a personal account, and using VPC or proxy or something else is doable and keeping the data" safe". Thing is, i cannot find a reliable ressource / tutorial to explain me how to implement .
Do you have any element to help me ?
thanks

Okay @Alter345 , I guess I have an idea of what your are trying to do. You can create a VPC for your RDS instance and allocate an Elastic IP address. Check this tutorial out Tutorial: Create an Amazon VPC for use with a DB instance - Amazon Relational Database Service .

Ok i’ll check this thanks !
then when i have an elastic IP, i can go with API call from bubble and run lambda function - i guess :wink: thank s!