Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • N node-http-proxy
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 482
    • Issues 482
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 102
    • Merge requests 102
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • http ... PARTY!
  • node-http-proxy
  • Merge requests
  • !1187

FEAT: Bindings section allows for per host name forward / target.

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/peerbelt/master into master Jun 25, 2017
  • Overview 1
  • Commits 1
  • Pipelines 0
  • Changes 4

Created by: krassif

Status

READY

Migrations

NO

Description

Single proxy may handle requests targeting multiple "hosts"/ DNS entries and then distribute the load as per the caller specified host. Both target host and target port are part of the load distribution.

For instance, consider the following distribution spec:

var binding = {
    "yarn.pronto.peerbelt.com": {
        target: "https://yarnpkg.com:443",
        "changeOrigin": true
    },
    "google.pronto.peerbelt.com": {
        target: "https://www.google.com:443",
        "changeOrigin": true
    },
    "*.pronto.peerbelt.com": {
        target: "https://www.microsoft.com:443/en-us/",
        "changeOrigin": true
    },
    "pronto.peerbelt.com": {
        target: {
            host: "overlayads.herokuapp.com",
            port: 443,
            protocol: "https"
        },
        changeOrigin: true
    }
};

Based on it, HTTP request targeting:

  • yarn.pronto.peerbelt.com are getting forwarded to https://yarnpkg.com:443
  • pronto.peerbelt.com calls overlayads.herokuapp.com
  • something-different.pronto.peerbelt.com follows the wildcard rule hitting https://www.microsoft.com:443/en-us/ accordingly

Anything not found in the distribution spec follows the already existing proxy rules. For instance:

httpProxy.createServer({
  binding: binding,
  target: {
    host: "localhost",
    port: 3030
  }
}).listen(80)
.on( "error", socketErrorHandler );

with incoming request targeting my.peerbelt.com is simply forwarded to localhost:3030.

Todos

  • Tests
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/peerbelt/master