We recommend the https-proxy-agent library for carrying out HTTP operations from Node.js with QuotaGuard.


Installation

When you sign up with QuotaGuard, you will be provided with a unique username and password and a connection string that you can use when configuring your proxy service in your application, for example:   

http://username:password@static.quotaguard.com:9293

   

All requests that you make via this proxy will appear to the destination server to originate from one of the two static IPs you will be assigned when you sign up.

 

We recommend you store the connection string in an environment variable QUOTAGUARD_URL. If you have signed up via the add-ons platform on Heroku or cloudControl this variable will be automatically set in your production environment.


Integration

QuotaGuard will work with the standard http library, but we recommend using the https-proxy-agent library for ease of use.

 

var HttpsProxyAgent = require('https-proxy-agent');
var request = require('request');
var proxy = process.env.QUOTAGUARDSTATIC_URL;
var agent = new HttpsProxyAgent(proxy);
request({
	uri: "https://example.com/api",
	method: "POST",
	headers: {
		'content-type': 'application/x-www-form-urlencoded'
	},
	agent: agent,
	timeout: 10000,
	followRedirect: true,
	maxRedirects: 10,
	body: "name=john"
}, function(error, response, body) {
	console.log("Error" + error);
	console.log("Response: " + response);
	console.log("Body: " + body);
});

 

Other Libraries

 

We have examples for other common libraries as well, but if you can't find what you are looking for just send us a Support ticket and we'll get one sent to you.

 


If you have questions, or if this solution doesn’t work or fit your use case, please reach out to us at Support so we can help figure it out with you.


Working with sensitive data, like HIPAA, Financial, or Personally Identifiable Information (PII)? 

    Then you will want to check out our QuotaGuard Shield solution, it's the same as QuotaGuard Static, but with stronger end to end security for your requests. We can also help migrate current Static customers to Shield for free, just reach out to us at Support to request assistance.