Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caronte with target as string not working (but object is, kind of - without headers) #467

Closed
Rush opened this issue Sep 15, 2013 · 2 comments

Comments

@Rush
Copy link
Contributor

Rush commented Sep 15, 2013

var caronte = require('./index.js');
var proxy = caronte.createProxyServer({
});
var EventEmitter = require('events').EventEmitter;


require('http').createServer(function(req, res) {
  res.end("TEST");
}).listen(8089)

require('http').createServer(function(req, res) {
  proxy.web(req, res, {
    target: "http:https://127.0.0.1:8089",
/*    target: {
      protocol: 'http',
      port: 8089
    },*/
    ee: new EventEmitter()
  }
);
}).listen(8081);

Run with ab2 -v 2 -c 1 -n 20 http:https://127.0.0.1:8081/

Will yield:

> node ./test

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: connect ECONNREFUSED
    at errnoException (net.js:878:11)
    at Object.afterConnect [as oncomplete] (net.js:869:19)

Now uncomment the:

/*    target: {
      protocol: 'http',
      port: 8089
    },*/

The test will work but without headers being sent, please advice.

@yawnt
Copy link
Contributor

yawnt commented Sep 15, 2013

i didn't realize you were calling proxy.web directly, my bad.. in that case you do have to provide an object (not a string) .. this is also kinda lame.. i'll come up with something

about the headers.. i'm writing the outgoing pipeline described in the README.md which will implement res.writeHeader

yawnt added a commit that referenced this issue Sep 15, 2013
@yawnt yawnt closed this as completed Sep 15, 2013
@yawnt
Copy link
Contributor

yawnt commented Sep 15, 2013

works for me.. as a temporary workaround you can pass { target: require('url').parse("MYURL") }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants