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
  • !216

Re-emit 'start', 'forward' and 'end' events in RoutingProxy

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/coderarity/master into master Mar 28, 2012
  • Overview 4
  • Commits 4
  • Pipelines 0
  • Changes 2

Created by: coderarity

Fixes nodejitsu/node-http-proxy#214. This will re-emit more events from RoutingProxy so that you can listen for those events yourself. Be VERY careful for the following case, which will add a new listener for every request:

//DO NOT USE THIS CODE! IT'S BROKEN!
var httpProxy = require('http-proxy');

httpProxy.createServer(function (req, res, proxy) {

    var buffer = httpProxy.buffer(req);

    proxy.on('end', function() {
      console.log("The request was proxied (server)");
    });

    proxy.proxyRequest(req, res, {
      host: '127.0.0.1',
      port: 8080,
      buffer: buffer
    });

}).listen(8000);

It would be good if we could fix this case! This is a very easy problem to run into!

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