Skip to content

Latest commit

 

History

History
61 lines (48 loc) · 2.28 KB

README.md

File metadata and controls

61 lines (48 loc) · 2.28 KB

proxy

Codeship badge Code Climate Code Climate issues badge David badge

This repository contains the source code for a server that acts as a proxy for any number of other servers ("targets") running on the same host but different ports.

It allows for access to those targets from the same port (e.g. browser default 80) but different domains (e.g. example.com, api.example.com, example.org).

Setup

Configuration files and SSL certificates are managed by Park Ranger with the following configuration schema:

Config (object)

  • ports
    • http (number) - Port on which proxy should listen for HTTP requests
    • https (number) - Port on which proxy should listen for HTTPS requests
  • targets (array[Target]) – Targets with host values for matching requests
  • defaultTarget (Target) - Default target without host value should targets with host values not match requests

Target (object)

  • host (string) - Hostname for which proxy should listen for requests
  • http (string) - Hostname to which proxy should route HTTP requests
  • https (string) - Hostname to which proxy should route HTTPS requests

Example:

{
  "ports": {
    "http": 80,
    "https": 443
  },
  "targets": [{
    "host": "example.com",
    "http": "example.com:1234",
    "https": "example.com:5678"
  }, {
    "host": "example.org",
    "https": "example.com:1234",
    "https": "example.com:5678"
  }, {
    "host": "api.example.com",
    "https": "example.com:9876"
  }],
  "defaultTarget": {
    "http": "example.com:9191",
    "https": "example.com:9192"
  }
}

Scripts

Deployment scripts are available through Hoist. The following are also supported:

  • npm run dev: Runs the proxy and automatically reloads it when code changes are made during development