Node Unblocker 2025: Web Scraping Step-by-Step

Nathan Reynolds

Last edited on May 4, 2025
Last edited on May 4, 2025

Setup Guides

Diving Into Node Unblocker for Web Access

Node Unblocker is a nifty Node.js library designed for proxying and dynamically rewriting remote web pages. At its heart, Node Unblocker sets up a server instance that functions as a proxy right on your machine. This capability makes it a useful tool for navigating around geographical blocks or other access hurdles.

So, what exactly is this tool? Built using the popular Express framework, Node Unblocker essentially lets you create your own web proxy. Like any proxy server, it intercepts outgoing web requests from your machine, sends them to the target server, and then relays the response back to you.

One of the appealing aspects of Node Unblocker is its straightforward setup. You can get a basic proxy instance running on almost any compatible machine with just a handful of code lines. Beyond simple proxying, Node Unblocker also modifies URLs, typically adding a /proxy/ prefix before the actual web address. This URL rewriting can sometimes help bypass certain local network filters.

Given that web scraping often relies heavily on proxies to avoid detection and IP bans, Node Unblocker has found favour among developers, especially those who can deploy it on third-party servers or cloud platforms. By setting up Node Unblocker on a remote machine, you effectively create a personal proxy endpoint tailored for your data gathering tasks.

However, it's not a silver bullet. Node Unblocker does have its limitations. It can struggle with rendering complex, modern web pages. For instance, accessing sites heavily reliant on `postMessage` for communication (common in social media platforms) or those using sophisticated AJAX calls or OAuth for logins might prove challenging, as Node Unblocker may not handle these interactions correctly.

How Node Unblocker Operates

As we've touched upon, Node Unblocker establishes a web proxy server on a machine. Its primary job is to manage the HTTP/S traffic flowing between the user's machine (or the server it's running on) and the destination website.

While it serves well as a basic proxy, Node Unblocker offers advanced customization through its middleware system, which adds significant value, particularly if you don't already have a diverse proxy pool at your disposal. Without leveraging these features, the utility of Node Unblocker might diminish if you already use robust proxy solutions, like geographically diverse residential proxies.

Many of the powerful customization options are accessible via Node Unblocker’s middleware architecture. The specific middleware you use will depend heavily on your web scraping goals, but several common features stand out:

  • Content Security Policy (CSP) Removal: Disabling CSP headers can prevent issues where proxied content tries to interact with other sites, potentially breaking the proxy. It also allows executing inline scripts, handy for pages loading content dynamically via JavaScript.

  • Cookie Management: Proper cookie handling is crucial for maintaining user sessions, navigating multi-step processes (like logins or checkouts), and can even help lower the chances of getting blocked by target sites.

  • Redirect Handling: Middleware can ensure that HTTP redirects are correctly followed through the proxy, preventing requests from accidentally bypassing it.

Middleware is especially useful for modifying request and response details, tasks often restricted by standard proxy providers. With Node Unblocker, you gain fine-grained control over elements like request headers, making it a flexible tool for web scraping and related activities.

Furthermore, the configuration options allow for deeper tweaking of the proxy's behaviour. For example, while Node Unblocker defaults to forcing client-side JavaScript through the proxy, this can be disabled if needed for specific scenarios.

Getting Started: Prerequisites

If you're setting things up from scratch, you’ll need a couple of things before diving into Node Unblocker:

  1. Node.js Runtime

    First and foremost, you need the Node.js runtime environment installed on your system. Node Unblocker is a Node.js library, after all.

  2. An Integrated Development Environment (IDE) or Text Editor

    While you can use a simple text editor, an IDE designed for web development can make coding much smoother. Popular choices include Visual Studio Code, WebStorm, or Atom. We'll proceed assuming a general setup, applicable to most editors.

  3. (Optional) A Cloud Server Provider

    Running Node Unblocker locally means requests still originate from your own IP address. For effective web scraping or bypassing geo-restrictions, deploying it on a remote server (like a cloud VM) is highly recommended. You'll typically do this after confirming your setup works locally.

Installing and Setting Up Node.js

With your chosen editor ready, open its terminal or your system's command line. Navigate to your desired project directory and initialize a new Node.js project:

npm init -y

The -y flag accepts the default settings for the project configuration. You can omit it to customize details like package name or version, but these are mostly metadata and not critical for a simple setup.

Next, install the necessary packages: Node Unblocker itself and the Express framework:

npm

This command downloads and adds `unblocker` and `express` to your project dependencies. It also creates a node_modules directory and updates your package.json file, which tracks your project's dependencies and other settings. Now, create a new file named `server.js` (or similar) in your project's root directory.

Inside `server.js`, start by importing the libraries:

// Import necessary modules
const express = require('express');
const Unblocker = require('unblocker');

We use `const` here because we don't intend to reassign these variables. `require` is Node.js's way of importing modules. When `require('module_name')` is called, Node.js searches for and loads the specified module, either from its core libraries or from the installed `node_modules`.

Creating the Proxy Instance

Now, let's set up the Express application and the Node Unblocker middleware:

// Initialize Express app
const app = express();

// Configure Node Unblocker instance
const unblocker = new Unblocker({ prefix: '/myproxy/' }); // Using a different prefix

// Apply the unblocker middleware
app.use(unblocker);

First, we create an instance of the Express application (`app`). Then, we initialize Node Unblocker (`unblocker`), passing a configuration object. The `prefix` option (e.g., `/myproxy/`) dictates the URL path that triggers the proxy. Accessing a URL like `http://yourserver/myproxy/https://example.com` will route the request through Node Unblocker. Requests without this prefix will bypass the unblocker middleware.

Finally, `app.use(unblocker)` registers the Node Unblocker instance as middleware for our Express app. This means incoming requests matching the prefix will be handled by the unblocker.

You can also specify a port for your server:

// Define a port (optional, defaults often work)
const customPort = 8081;

Launching the Server

With the setup complete, we need to tell our Express app to start listening for connections:

// Define the port the server will listen on
const PORT = process.env.PORT || customPort || 8080; // Use environment variable, custom port, or default

// Start the server and handle upgrades
app.listen(PORT)
  .on('upgrade', unblocker.onUpgrade);

// Log a confirmation message
console.log(`Node Unblocker proxy running on port: ${PORT}`);

The `app.listen(PORT)` line starts the server. It attempts to use a port defined in the environment variables (`process.env.PORT`), falls back to our `customPort` if defined, and finally defaults to 8080. This flexible port handling is useful for deployment environments like cloud platforms.

The `.on('upgrade', unblocker.onUpgrade)` part is crucial. It allows Node Unblocker to handle protocol upgrades, such as those required by WebSockets. This ensures compatibility with websites using modern communication protocols beyond standard HTTP/S.

The `console.log` line simply prints a message to the console confirming the server is running and on which port.

Local Testing

Before deploying remotely, always test your Node Unblocker instance locally to catch any basic errors.

Open your terminal, navigate to your project directory (if you aren't already there):

cd

Then, start the server using Node.js:

node

(Replace `server.js` with your actual file name if different.)

Once you see the confirmation message in the console, open your web browser. Navigate to:

Make sure to replace `PORT` with the actual port number shown in your console (e.g., 8081 or 8080) and `/myproxy/` with the prefix you configured. Also, replace `https://example.com/` with the site you want to test. If everything is configured correctly, the target website should load within your browser, served via your local Node Unblocker proxy. You can also test this using command-line tools like cURL.

Deploying to a Remote Server

Running Node Unblocker locally is fine for testing or bypassing simple network restrictions, but it doesn't mask your IP address for accessing geo-restricted content or large-scale scraping.

Deploying Node Unblocker to a cloud server gives it a different IP address, enabling you to use it for bypassing geographical limitations, avoiding IP blocks, and more serious web scraping tasks.

Numerous cloud providers offer virtual machines (VMs) suitable for this, such as Google Cloud Platform (GCP), AWS EC2, DigitalOcean Droplets, Heroku, or Render. We'll use Google Cloud Compute Engine as an example due to its accessible low-cost options.

First, ensure your `package.json` file is ready for deployment. You might need to specify the Node.js version and a start script:

{
  "name": "my-node-unblocker",
  "version": "1.0.0",
  "description": "A simple Node Unblocker proxy",
  "main": "server.js",
  "private": true,
  "scripts": {
    "start": "node server.js"
  },
  "engines": {
    "node": ">=18.0.0"
  },
  "dependencies": {
    "express": "^4.18.2",
    "unblocker": "^2.3.0"
  }
}

The `scripts.start` command tells the hosting platform how to run your application. The `engines.node` field specifies the required Node.js version range for compatibility.

Next, set up an account with your chosen cloud provider (e.g., Google Cloud) and create a new VM instance. Typically, you'll choose an operating system (like Ubuntu or Debian), a machine type (smaller, cheaper ones often suffice), and a region.

Creating a VM instance in Google Cloud

Select a suitable instance (e.g., the `e2-micro` or `e2-small` on GCP are often cost-effective) and launch it.

Once the instance is running, you need to connect to it. Most cloud providers offer browser-based SSH access, or you can use a standard SSH client from your local terminal.

Connecting to the VM via SSH in Google Cloud

You'll typically land in a Linux shell environment (like Ubuntu). You might need to authenticate your cloud account again within the SSH session.

If using Ubuntu/Debian, you might need to adjust the `app.listen` call in your `server.js` to bind to all network interfaces, allowing external connections:

// Listen on all interfaces for external access
app.listen(PORT, '0.0.0.0')
  .on('upgrade', unblocker.onUpgrade);

console.log(`Node Unblocker proxy running on port: ${PORT}, accessible externally`);

Now, upload your project files (`server.js`, `package.json`) to the VM. Browser-based SSH often has an "Upload Files" button. Alternatively, use `scp` from your local machine:



Once connected and files uploaded, install Node.js and npm on the VM. Consult the NodeSource documentation for up-to-date instructions for your Linux distribution. Typically, this involves adding their repository and then using `apt-get` or `yum`.

After installing Node.js, navigate to your project directory on the VM, install dependencies, and start the server:

cd /path/on/server/
npm install
npm start

If successful, you should see your confirmation message. Now, from your *local* machine's browser, try accessing a site via your deployed proxy:

Replace `VM_EXTERNAL_IP` with your VM's public IP address, `PORT` with the correct port number, and `/myproxy/` with your prefix. Using a site like `httpbin.org/ip` will show you the IP address making the request – it should be your VM's IP, not your local one.

If you encounter connection errors, you may need to configure firewall rules in your cloud provider's settings to allow incoming traffic on the specific port your Node Unblocker server is using (e.g., TCP port 8080 or 8081).

Next Steps and Considerations

You now have a functional Node Unblocker proxy server, deployable either locally or on a remote machine. This can be a valuable asset for bypassing certain web restrictions or for small-scale web scraping projects, provided it aligns with your cloud provider's terms of service.

However, relying on a single Node Unblocker instance on one VM means all your requests originate from a single IP address. For any significant scraping activity, this IP can quickly get flagged and blocked by target websites.

Node Unblocker setups are most effective for light usage or if you have the resources and technical know-how to manage multiple instances across different VMs, essentially creating a small, self-managed proxy network. This can help distribute requests and reduce the likelihood of blocks.

For larger, more demanding projects, or if managing multiple VMs becomes cumbersome and costly, transitioning to a dedicated proxy service provider like Evomi is often more practical. Professional services offer vast pools of diverse IP addresses (Residential, Mobile, Datacenter) designed for scale, typically providing better reliability, wider geographic coverage, and often a lower cost per IP or per GB compared to running numerous individual VMs. Many, including Evomi, also offer free trials, allowing you to test their infrastructure risk-free before committing.

Diving Into Node Unblocker for Web Access

Node Unblocker is a nifty Node.js library designed for proxying and dynamically rewriting remote web pages. At its heart, Node Unblocker sets up a server instance that functions as a proxy right on your machine. This capability makes it a useful tool for navigating around geographical blocks or other access hurdles.

So, what exactly is this tool? Built using the popular Express framework, Node Unblocker essentially lets you create your own web proxy. Like any proxy server, it intercepts outgoing web requests from your machine, sends them to the target server, and then relays the response back to you.

One of the appealing aspects of Node Unblocker is its straightforward setup. You can get a basic proxy instance running on almost any compatible machine with just a handful of code lines. Beyond simple proxying, Node Unblocker also modifies URLs, typically adding a /proxy/ prefix before the actual web address. This URL rewriting can sometimes help bypass certain local network filters.

Given that web scraping often relies heavily on proxies to avoid detection and IP bans, Node Unblocker has found favour among developers, especially those who can deploy it on third-party servers or cloud platforms. By setting up Node Unblocker on a remote machine, you effectively create a personal proxy endpoint tailored for your data gathering tasks.

However, it's not a silver bullet. Node Unblocker does have its limitations. It can struggle with rendering complex, modern web pages. For instance, accessing sites heavily reliant on `postMessage` for communication (common in social media platforms) or those using sophisticated AJAX calls or OAuth for logins might prove challenging, as Node Unblocker may not handle these interactions correctly.

How Node Unblocker Operates

As we've touched upon, Node Unblocker establishes a web proxy server on a machine. Its primary job is to manage the HTTP/S traffic flowing between the user's machine (or the server it's running on) and the destination website.

While it serves well as a basic proxy, Node Unblocker offers advanced customization through its middleware system, which adds significant value, particularly if you don't already have a diverse proxy pool at your disposal. Without leveraging these features, the utility of Node Unblocker might diminish if you already use robust proxy solutions, like geographically diverse residential proxies.

Many of the powerful customization options are accessible via Node Unblocker’s middleware architecture. The specific middleware you use will depend heavily on your web scraping goals, but several common features stand out:

  • Content Security Policy (CSP) Removal: Disabling CSP headers can prevent issues where proxied content tries to interact with other sites, potentially breaking the proxy. It also allows executing inline scripts, handy for pages loading content dynamically via JavaScript.

  • Cookie Management: Proper cookie handling is crucial for maintaining user sessions, navigating multi-step processes (like logins or checkouts), and can even help lower the chances of getting blocked by target sites.

  • Redirect Handling: Middleware can ensure that HTTP redirects are correctly followed through the proxy, preventing requests from accidentally bypassing it.

Middleware is especially useful for modifying request and response details, tasks often restricted by standard proxy providers. With Node Unblocker, you gain fine-grained control over elements like request headers, making it a flexible tool for web scraping and related activities.

Furthermore, the configuration options allow for deeper tweaking of the proxy's behaviour. For example, while Node Unblocker defaults to forcing client-side JavaScript through the proxy, this can be disabled if needed for specific scenarios.

Getting Started: Prerequisites

If you're setting things up from scratch, you’ll need a couple of things before diving into Node Unblocker:

  1. Node.js Runtime

    First and foremost, you need the Node.js runtime environment installed on your system. Node Unblocker is a Node.js library, after all.

  2. An Integrated Development Environment (IDE) or Text Editor

    While you can use a simple text editor, an IDE designed for web development can make coding much smoother. Popular choices include Visual Studio Code, WebStorm, or Atom. We'll proceed assuming a general setup, applicable to most editors.

  3. (Optional) A Cloud Server Provider

    Running Node Unblocker locally means requests still originate from your own IP address. For effective web scraping or bypassing geo-restrictions, deploying it on a remote server (like a cloud VM) is highly recommended. You'll typically do this after confirming your setup works locally.

Installing and Setting Up Node.js

With your chosen editor ready, open its terminal or your system's command line. Navigate to your desired project directory and initialize a new Node.js project:

npm init -y

The -y flag accepts the default settings for the project configuration. You can omit it to customize details like package name or version, but these are mostly metadata and not critical for a simple setup.

Next, install the necessary packages: Node Unblocker itself and the Express framework:

npm

This command downloads and adds `unblocker` and `express` to your project dependencies. It also creates a node_modules directory and updates your package.json file, which tracks your project's dependencies and other settings. Now, create a new file named `server.js` (or similar) in your project's root directory.

Inside `server.js`, start by importing the libraries:

// Import necessary modules
const express = require('express');
const Unblocker = require('unblocker');

We use `const` here because we don't intend to reassign these variables. `require` is Node.js's way of importing modules. When `require('module_name')` is called, Node.js searches for and loads the specified module, either from its core libraries or from the installed `node_modules`.

Creating the Proxy Instance

Now, let's set up the Express application and the Node Unblocker middleware:

// Initialize Express app
const app = express();

// Configure Node Unblocker instance
const unblocker = new Unblocker({ prefix: '/myproxy/' }); // Using a different prefix

// Apply the unblocker middleware
app.use(unblocker);

First, we create an instance of the Express application (`app`). Then, we initialize Node Unblocker (`unblocker`), passing a configuration object. The `prefix` option (e.g., `/myproxy/`) dictates the URL path that triggers the proxy. Accessing a URL like `http://yourserver/myproxy/https://example.com` will route the request through Node Unblocker. Requests without this prefix will bypass the unblocker middleware.

Finally, `app.use(unblocker)` registers the Node Unblocker instance as middleware for our Express app. This means incoming requests matching the prefix will be handled by the unblocker.

You can also specify a port for your server:

// Define a port (optional, defaults often work)
const customPort = 8081;

Launching the Server

With the setup complete, we need to tell our Express app to start listening for connections:

// Define the port the server will listen on
const PORT = process.env.PORT || customPort || 8080; // Use environment variable, custom port, or default

// Start the server and handle upgrades
app.listen(PORT)
  .on('upgrade', unblocker.onUpgrade);

// Log a confirmation message
console.log(`Node Unblocker proxy running on port: ${PORT}`);

The `app.listen(PORT)` line starts the server. It attempts to use a port defined in the environment variables (`process.env.PORT`), falls back to our `customPort` if defined, and finally defaults to 8080. This flexible port handling is useful for deployment environments like cloud platforms.

The `.on('upgrade', unblocker.onUpgrade)` part is crucial. It allows Node Unblocker to handle protocol upgrades, such as those required by WebSockets. This ensures compatibility with websites using modern communication protocols beyond standard HTTP/S.

The `console.log` line simply prints a message to the console confirming the server is running and on which port.

Local Testing

Before deploying remotely, always test your Node Unblocker instance locally to catch any basic errors.

Open your terminal, navigate to your project directory (if you aren't already there):

cd

Then, start the server using Node.js:

node

(Replace `server.js` with your actual file name if different.)

Once you see the confirmation message in the console, open your web browser. Navigate to:

Make sure to replace `PORT` with the actual port number shown in your console (e.g., 8081 or 8080) and `/myproxy/` with the prefix you configured. Also, replace `https://example.com/` with the site you want to test. If everything is configured correctly, the target website should load within your browser, served via your local Node Unblocker proxy. You can also test this using command-line tools like cURL.

Deploying to a Remote Server

Running Node Unblocker locally is fine for testing or bypassing simple network restrictions, but it doesn't mask your IP address for accessing geo-restricted content or large-scale scraping.

Deploying Node Unblocker to a cloud server gives it a different IP address, enabling you to use it for bypassing geographical limitations, avoiding IP blocks, and more serious web scraping tasks.

Numerous cloud providers offer virtual machines (VMs) suitable for this, such as Google Cloud Platform (GCP), AWS EC2, DigitalOcean Droplets, Heroku, or Render. We'll use Google Cloud Compute Engine as an example due to its accessible low-cost options.

First, ensure your `package.json` file is ready for deployment. You might need to specify the Node.js version and a start script:

{
  "name": "my-node-unblocker",
  "version": "1.0.0",
  "description": "A simple Node Unblocker proxy",
  "main": "server.js",
  "private": true,
  "scripts": {
    "start": "node server.js"
  },
  "engines": {
    "node": ">=18.0.0"
  },
  "dependencies": {
    "express": "^4.18.2",
    "unblocker": "^2.3.0"
  }
}

The `scripts.start` command tells the hosting platform how to run your application. The `engines.node` field specifies the required Node.js version range for compatibility.

Next, set up an account with your chosen cloud provider (e.g., Google Cloud) and create a new VM instance. Typically, you'll choose an operating system (like Ubuntu or Debian), a machine type (smaller, cheaper ones often suffice), and a region.

Creating a VM instance in Google Cloud

Select a suitable instance (e.g., the `e2-micro` or `e2-small` on GCP are often cost-effective) and launch it.

Once the instance is running, you need to connect to it. Most cloud providers offer browser-based SSH access, or you can use a standard SSH client from your local terminal.

Connecting to the VM via SSH in Google Cloud

You'll typically land in a Linux shell environment (like Ubuntu). You might need to authenticate your cloud account again within the SSH session.

If using Ubuntu/Debian, you might need to adjust the `app.listen` call in your `server.js` to bind to all network interfaces, allowing external connections:

// Listen on all interfaces for external access
app.listen(PORT, '0.0.0.0')
  .on('upgrade', unblocker.onUpgrade);

console.log(`Node Unblocker proxy running on port: ${PORT}, accessible externally`);

Now, upload your project files (`server.js`, `package.json`) to the VM. Browser-based SSH often has an "Upload Files" button. Alternatively, use `scp` from your local machine:



Once connected and files uploaded, install Node.js and npm on the VM. Consult the NodeSource documentation for up-to-date instructions for your Linux distribution. Typically, this involves adding their repository and then using `apt-get` or `yum`.

After installing Node.js, navigate to your project directory on the VM, install dependencies, and start the server:

cd /path/on/server/
npm install
npm start

If successful, you should see your confirmation message. Now, from your *local* machine's browser, try accessing a site via your deployed proxy:

Replace `VM_EXTERNAL_IP` with your VM's public IP address, `PORT` with the correct port number, and `/myproxy/` with your prefix. Using a site like `httpbin.org/ip` will show you the IP address making the request – it should be your VM's IP, not your local one.

If you encounter connection errors, you may need to configure firewall rules in your cloud provider's settings to allow incoming traffic on the specific port your Node Unblocker server is using (e.g., TCP port 8080 or 8081).

Next Steps and Considerations

You now have a functional Node Unblocker proxy server, deployable either locally or on a remote machine. This can be a valuable asset for bypassing certain web restrictions or for small-scale web scraping projects, provided it aligns with your cloud provider's terms of service.

However, relying on a single Node Unblocker instance on one VM means all your requests originate from a single IP address. For any significant scraping activity, this IP can quickly get flagged and blocked by target websites.

Node Unblocker setups are most effective for light usage or if you have the resources and technical know-how to manage multiple instances across different VMs, essentially creating a small, self-managed proxy network. This can help distribute requests and reduce the likelihood of blocks.

For larger, more demanding projects, or if managing multiple VMs becomes cumbersome and costly, transitioning to a dedicated proxy service provider like Evomi is often more practical. Professional services offer vast pools of diverse IP addresses (Residential, Mobile, Datacenter) designed for scale, typically providing better reliability, wider geographic coverage, and often a lower cost per IP or per GB compared to running numerous individual VMs. Many, including Evomi, also offer free trials, allowing you to test their infrastructure risk-free before committing.

Diving Into Node Unblocker for Web Access

Node Unblocker is a nifty Node.js library designed for proxying and dynamically rewriting remote web pages. At its heart, Node Unblocker sets up a server instance that functions as a proxy right on your machine. This capability makes it a useful tool for navigating around geographical blocks or other access hurdles.

So, what exactly is this tool? Built using the popular Express framework, Node Unblocker essentially lets you create your own web proxy. Like any proxy server, it intercepts outgoing web requests from your machine, sends them to the target server, and then relays the response back to you.

One of the appealing aspects of Node Unblocker is its straightforward setup. You can get a basic proxy instance running on almost any compatible machine with just a handful of code lines. Beyond simple proxying, Node Unblocker also modifies URLs, typically adding a /proxy/ prefix before the actual web address. This URL rewriting can sometimes help bypass certain local network filters.

Given that web scraping often relies heavily on proxies to avoid detection and IP bans, Node Unblocker has found favour among developers, especially those who can deploy it on third-party servers or cloud platforms. By setting up Node Unblocker on a remote machine, you effectively create a personal proxy endpoint tailored for your data gathering tasks.

However, it's not a silver bullet. Node Unblocker does have its limitations. It can struggle with rendering complex, modern web pages. For instance, accessing sites heavily reliant on `postMessage` for communication (common in social media platforms) or those using sophisticated AJAX calls or OAuth for logins might prove challenging, as Node Unblocker may not handle these interactions correctly.

How Node Unblocker Operates

As we've touched upon, Node Unblocker establishes a web proxy server on a machine. Its primary job is to manage the HTTP/S traffic flowing between the user's machine (or the server it's running on) and the destination website.

While it serves well as a basic proxy, Node Unblocker offers advanced customization through its middleware system, which adds significant value, particularly if you don't already have a diverse proxy pool at your disposal. Without leveraging these features, the utility of Node Unblocker might diminish if you already use robust proxy solutions, like geographically diverse residential proxies.

Many of the powerful customization options are accessible via Node Unblocker’s middleware architecture. The specific middleware you use will depend heavily on your web scraping goals, but several common features stand out:

  • Content Security Policy (CSP) Removal: Disabling CSP headers can prevent issues where proxied content tries to interact with other sites, potentially breaking the proxy. It also allows executing inline scripts, handy for pages loading content dynamically via JavaScript.

  • Cookie Management: Proper cookie handling is crucial for maintaining user sessions, navigating multi-step processes (like logins or checkouts), and can even help lower the chances of getting blocked by target sites.

  • Redirect Handling: Middleware can ensure that HTTP redirects are correctly followed through the proxy, preventing requests from accidentally bypassing it.

Middleware is especially useful for modifying request and response details, tasks often restricted by standard proxy providers. With Node Unblocker, you gain fine-grained control over elements like request headers, making it a flexible tool for web scraping and related activities.

Furthermore, the configuration options allow for deeper tweaking of the proxy's behaviour. For example, while Node Unblocker defaults to forcing client-side JavaScript through the proxy, this can be disabled if needed for specific scenarios.

Getting Started: Prerequisites

If you're setting things up from scratch, you’ll need a couple of things before diving into Node Unblocker:

  1. Node.js Runtime

    First and foremost, you need the Node.js runtime environment installed on your system. Node Unblocker is a Node.js library, after all.

  2. An Integrated Development Environment (IDE) or Text Editor

    While you can use a simple text editor, an IDE designed for web development can make coding much smoother. Popular choices include Visual Studio Code, WebStorm, or Atom. We'll proceed assuming a general setup, applicable to most editors.

  3. (Optional) A Cloud Server Provider

    Running Node Unblocker locally means requests still originate from your own IP address. For effective web scraping or bypassing geo-restrictions, deploying it on a remote server (like a cloud VM) is highly recommended. You'll typically do this after confirming your setup works locally.

Installing and Setting Up Node.js

With your chosen editor ready, open its terminal or your system's command line. Navigate to your desired project directory and initialize a new Node.js project:

npm init -y

The -y flag accepts the default settings for the project configuration. You can omit it to customize details like package name or version, but these are mostly metadata and not critical for a simple setup.

Next, install the necessary packages: Node Unblocker itself and the Express framework:

npm

This command downloads and adds `unblocker` and `express` to your project dependencies. It also creates a node_modules directory and updates your package.json file, which tracks your project's dependencies and other settings. Now, create a new file named `server.js` (or similar) in your project's root directory.

Inside `server.js`, start by importing the libraries:

// Import necessary modules
const express = require('express');
const Unblocker = require('unblocker');

We use `const` here because we don't intend to reassign these variables. `require` is Node.js's way of importing modules. When `require('module_name')` is called, Node.js searches for and loads the specified module, either from its core libraries or from the installed `node_modules`.

Creating the Proxy Instance

Now, let's set up the Express application and the Node Unblocker middleware:

// Initialize Express app
const app = express();

// Configure Node Unblocker instance
const unblocker = new Unblocker({ prefix: '/myproxy/' }); // Using a different prefix

// Apply the unblocker middleware
app.use(unblocker);

First, we create an instance of the Express application (`app`). Then, we initialize Node Unblocker (`unblocker`), passing a configuration object. The `prefix` option (e.g., `/myproxy/`) dictates the URL path that triggers the proxy. Accessing a URL like `http://yourserver/myproxy/https://example.com` will route the request through Node Unblocker. Requests without this prefix will bypass the unblocker middleware.

Finally, `app.use(unblocker)` registers the Node Unblocker instance as middleware for our Express app. This means incoming requests matching the prefix will be handled by the unblocker.

You can also specify a port for your server:

// Define a port (optional, defaults often work)
const customPort = 8081;

Launching the Server

With the setup complete, we need to tell our Express app to start listening for connections:

// Define the port the server will listen on
const PORT = process.env.PORT || customPort || 8080; // Use environment variable, custom port, or default

// Start the server and handle upgrades
app.listen(PORT)
  .on('upgrade', unblocker.onUpgrade);

// Log a confirmation message
console.log(`Node Unblocker proxy running on port: ${PORT}`);

The `app.listen(PORT)` line starts the server. It attempts to use a port defined in the environment variables (`process.env.PORT`), falls back to our `customPort` if defined, and finally defaults to 8080. This flexible port handling is useful for deployment environments like cloud platforms.

The `.on('upgrade', unblocker.onUpgrade)` part is crucial. It allows Node Unblocker to handle protocol upgrades, such as those required by WebSockets. This ensures compatibility with websites using modern communication protocols beyond standard HTTP/S.

The `console.log` line simply prints a message to the console confirming the server is running and on which port.

Local Testing

Before deploying remotely, always test your Node Unblocker instance locally to catch any basic errors.

Open your terminal, navigate to your project directory (if you aren't already there):

cd

Then, start the server using Node.js:

node

(Replace `server.js` with your actual file name if different.)

Once you see the confirmation message in the console, open your web browser. Navigate to:

Make sure to replace `PORT` with the actual port number shown in your console (e.g., 8081 or 8080) and `/myproxy/` with the prefix you configured. Also, replace `https://example.com/` with the site you want to test. If everything is configured correctly, the target website should load within your browser, served via your local Node Unblocker proxy. You can also test this using command-line tools like cURL.

Deploying to a Remote Server

Running Node Unblocker locally is fine for testing or bypassing simple network restrictions, but it doesn't mask your IP address for accessing geo-restricted content or large-scale scraping.

Deploying Node Unblocker to a cloud server gives it a different IP address, enabling you to use it for bypassing geographical limitations, avoiding IP blocks, and more serious web scraping tasks.

Numerous cloud providers offer virtual machines (VMs) suitable for this, such as Google Cloud Platform (GCP), AWS EC2, DigitalOcean Droplets, Heroku, or Render. We'll use Google Cloud Compute Engine as an example due to its accessible low-cost options.

First, ensure your `package.json` file is ready for deployment. You might need to specify the Node.js version and a start script:

{
  "name": "my-node-unblocker",
  "version": "1.0.0",
  "description": "A simple Node Unblocker proxy",
  "main": "server.js",
  "private": true,
  "scripts": {
    "start": "node server.js"
  },
  "engines": {
    "node": ">=18.0.0"
  },
  "dependencies": {
    "express": "^4.18.2",
    "unblocker": "^2.3.0"
  }
}

The `scripts.start` command tells the hosting platform how to run your application. The `engines.node` field specifies the required Node.js version range for compatibility.

Next, set up an account with your chosen cloud provider (e.g., Google Cloud) and create a new VM instance. Typically, you'll choose an operating system (like Ubuntu or Debian), a machine type (smaller, cheaper ones often suffice), and a region.

Creating a VM instance in Google Cloud

Select a suitable instance (e.g., the `e2-micro` or `e2-small` on GCP are often cost-effective) and launch it.

Once the instance is running, you need to connect to it. Most cloud providers offer browser-based SSH access, or you can use a standard SSH client from your local terminal.

Connecting to the VM via SSH in Google Cloud

You'll typically land in a Linux shell environment (like Ubuntu). You might need to authenticate your cloud account again within the SSH session.

If using Ubuntu/Debian, you might need to adjust the `app.listen` call in your `server.js` to bind to all network interfaces, allowing external connections:

// Listen on all interfaces for external access
app.listen(PORT, '0.0.0.0')
  .on('upgrade', unblocker.onUpgrade);

console.log(`Node Unblocker proxy running on port: ${PORT}, accessible externally`);

Now, upload your project files (`server.js`, `package.json`) to the VM. Browser-based SSH often has an "Upload Files" button. Alternatively, use `scp` from your local machine:



Once connected and files uploaded, install Node.js and npm on the VM. Consult the NodeSource documentation for up-to-date instructions for your Linux distribution. Typically, this involves adding their repository and then using `apt-get` or `yum`.

After installing Node.js, navigate to your project directory on the VM, install dependencies, and start the server:

cd /path/on/server/
npm install
npm start

If successful, you should see your confirmation message. Now, from your *local* machine's browser, try accessing a site via your deployed proxy:

Replace `VM_EXTERNAL_IP` with your VM's public IP address, `PORT` with the correct port number, and `/myproxy/` with your prefix. Using a site like `httpbin.org/ip` will show you the IP address making the request – it should be your VM's IP, not your local one.

If you encounter connection errors, you may need to configure firewall rules in your cloud provider's settings to allow incoming traffic on the specific port your Node Unblocker server is using (e.g., TCP port 8080 or 8081).

Next Steps and Considerations

You now have a functional Node Unblocker proxy server, deployable either locally or on a remote machine. This can be a valuable asset for bypassing certain web restrictions or for small-scale web scraping projects, provided it aligns with your cloud provider's terms of service.

However, relying on a single Node Unblocker instance on one VM means all your requests originate from a single IP address. For any significant scraping activity, this IP can quickly get flagged and blocked by target websites.

Node Unblocker setups are most effective for light usage or if you have the resources and technical know-how to manage multiple instances across different VMs, essentially creating a small, self-managed proxy network. This can help distribute requests and reduce the likelihood of blocks.

For larger, more demanding projects, or if managing multiple VMs becomes cumbersome and costly, transitioning to a dedicated proxy service provider like Evomi is often more practical. Professional services offer vast pools of diverse IP addresses (Residential, Mobile, Datacenter) designed for scale, typically providing better reliability, wider geographic coverage, and often a lower cost per IP or per GB compared to running numerous individual VMs. Many, including Evomi, also offer free trials, allowing you to test their infrastructure risk-free before committing.

Author

Nathan Reynolds

Web Scraping & Automation Specialist

About Author

Nathan specializes in web scraping techniques, automation tools, and data-driven decision-making. He helps businesses extract valuable insights from the web using ethical and efficient scraping methods powered by advanced proxies. His expertise covers overcoming anti-bot mechanisms, optimizing proxy rotation, and ensuring compliance with data privacy regulations.

Like this article? Share it.
You asked, we answer - Users questions:
How can I effectively scale a Node Unblocker setup for larger web scraping tasks beyond a single server instance?+
Are there security risks associated with deploying Node Unblocker on a public cloud server, and how can they be mitigated?+
Can Node Unblocker middleware be used to automatically rotate user agents or handle sites requiring browser fingerprinting?+
What are the typical running costs of a self-hosted Node Unblocker on a cloud VM versus using a commercial residential proxy service?+

In This Article

Read More Blogs