Node.js Quick Start Guide - QuotaGuard Static IP

    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-proxy.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 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

    Learn How To Access QuotaGuard using urllib2

    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.


    Ready to Get Started?

    Get in touch or create a free trial account