Skip to content

Quickstart: Outbound Proxy

If you need to access a resource, such as MySQL, Postgres or MongoDB database, but to access that service, you need to provide a static, whitelisted IP then utilizing a Noble IP static IP Outbound Proxy is the solution.

Creating an Outbound Proxy

Start by signing up for an account and accessing the dashboard.

  1. Navigate to the Outbound Proxies tab and select Create Outbound ProxyCreate Outbound Proxy
  2. Once the proxy is created you will get 2 static IP address. You will need to white list both addresses. We provide 2 addresses for high availablity, in case one became unreachable, your service can failover to the other one.
  3. Make note of the Proxy Credentials. You will need this to utilize your proxy.

    TIP

    Explore our documentation for indepth guides on intergrating with your language or platform of choice.

    Credentials

Using a HTTPS Proxy

You can utilize a HTTPS proxy when making HTTP requests from your service. This will route your requests through the proxy and the endpoint you access will see the static IP assigned to your proxy.

js
import fetch from "node-fetch";
import { HttpProxyAgent } from "hpagent";
const { HttpProxyAgent } = require("hpagent");
const response = await fetch("https://example.com", {
  agent: new HttpProxyAgent({
    keepAlive: true,
    proxy: "https://noble:fp_NOBLETOKEN@p-12345.noble-ip.com:3129",
  }),
});
python
import requests

proxies = {
  'http': 'https://noble:fp_NOBLETOKEN@p-12345.noble-ip.com:3129',
  'https': 'https://noble:fp_NOBLETOKEN@p-12345.noble-ip.com:3129'
}

response = requests.get('https://example.com', proxies=proxies)
print(response.text)
ruby
require 'net/http'

proxy_url = URI.parse('https://noble:fp_NOBLETOKEN@p-12345.noble-ip.com:3129')
target_url = URI.parse('https://www.example.com')

proxy = Net::HTTP::Proxy(proxy_url.host, proxy_url.port, proxy_url.username, proxy_url.password)
response = proxy.start(target_url.host, target_url.port, use_ssl: true) do |http|
  http.get(target_url.path)
end

puts response.body

Using a SOCKS5 Proxy

Several applications have built-in support for SOCKS5 proxies. It can be as simple as setting the appropriate environmnet variables.

bash
export ALL_PROXY=socks5://noble:fp_NOBLETOKEN@p-12345.noble-ip.com:1080
./my-app

Using Noble Port Leases

If you need to access a service, for example, a database, but your database driver or platform does not support SOCKS5 proxies, you can utilize Noble Port Leases. Noble Port Leases provides a hostname and port that your application can connect to that will proxy your traffic to your desired location. Noble Port leases automatically expire once your connection is closed.

TIP

Language specific client libraries are coming soon, for now we will utilize the JSON API.

js
import fetch from 'node-fetch';
import mysql from require('mysql');

const mysqlHost = 'mysql.company.com';
const mysqlPort = 3361;

const lease = await fetch("https://api.noble-ip.com/v1/leases", {
  method: "POST",
  headers: {
    "Content-Type": "application/json; charset=utf-8"
  },
  body: JSON.stringify({
    target_host: mysqlHost,
    target_port: mysqlPort,
    proxy_token: 'fp_NOBLETOKEN',
  }),
});

// MySQL database configuration
const connection = mysql.createConnection({
  host: lease.hostname,
  port: lease.port,
  user: 'your_username',
  password: 'your_password',
  database: 'your_database'
});

// Establish the connection
connection.connect((error) => {
  if (error) {
    console.error('Error connecting to the database: ', error);
    return;
  }

  console.log('Connected to the MySQL database.');

  // Perform a query
  const query = 'SELECT * FROM your_table';
  connection.query(query, (error, results) => {
    if (error) {
      console.error('Error executing query: ', error);
      return;
    }

    console.log('Query results:', results);

    // Close the connection
    connection.end((error) => {
      if (error) {
        console.error('Error closing the database connection: ', error);
        return;
      }
      console.log('Connection closed.');
    });
  });
});