Reverse HTTP Client

1.3.0 · abandoned · verified Wed Apr 22

reverse-http is a JavaScript client library designed to establish a reverse HTTP connection to a server that supports the Reverse HTTP (PTTH/1.0) draft specification. This unique protocol allows an outbound HTTP connection from a client to act as a server, receiving incoming HTTP requests from the remote endpoint. The library is currently at version 1.3.0 and explicitly requires a Node.js runtime of version 0.12 or higher. Given the extremely old engine requirement, it is effectively unmaintained for modern Node.js environments and does not follow a current release cadence. Its primary differentiator is its specific implementation of the niche PTTH/1.0 protocol, offering a way for clients behind restrictive firewalls or NATs to expose services.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates establishing a reverse HTTP connection and handling an incoming request that arrives back through the tunnel.

const reverseHttp = require('reverse-http')

const opts = {
  hostname: 'example.com',
  path: '/foo'
}

// Open an HTTP connection to example.com and accept reverse HTTP
// requests back to this machine. This effectively turns the client
// into a server for requests coming back through the established tunnel.
reverseHttp(opts, function (req, res) {
  console.log('Incoming request:', req.method, req.url)

  res.writeHead(201, {
    'Content-Type': 'text/plain',
    'Content-Length': 11
  })

  res.end('Hello World')
})

view raw JSON →