Configure NodeJS Proxy Server
If you want to access the internet from an IDNT Compute Cloud instance, you must use the IDNT Compute Cloud proxy server.
Proxy Settings for NodeJS
For NodeJS applications, there are several ways to configure the proxy server:
1. Environment Variables
The simplest method is to use environment variables:
export http_proxy=http://proxy.idnt.net:3128
export https_proxy=http://proxy.idnt.net:3128
export HTTP_PROXY=http://proxy.idnt.net:3128
export HTTPS_PROXY=http://proxy.idnt.net:3128
2. HTTP Client Configuration
For Node.js HTTP requests, you can configure the proxy directly:
const http = require('http');
const https = require('https');
const httpAgent = new http.Agent({
proxy: 'http://proxy.idnt.net:3128'
});
const httpsAgent = new https.Agent({
proxy: 'http://proxy.idnt.net:3128'
});
// Usage with fetch or axios
fetch('https://example.com', { agent: httpsAgent });
3. NPM Proxy Configuration
For NPM package downloads:
npm config set proxy http://proxy.idnt.net:3128
npm config set https-proxy http://proxy.idnt.net:3128
Proxy Server Details
- Proxy Server: proxy.idnt.net
- Port: 3128
- Protocol: HTTP
- Authentication: Not required
More Information
For more information about proxy configuration, see our related articles for Linux, WordPress, and PHP.