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

Example code does not work #7

Closed
michaellopez opened this issue Mar 20, 2014 · 9 comments
Closed

Example code does not work #7

michaellopez opened this issue Mar 20, 2014 · 9 comments

Comments

@michaellopez
Copy link

Hi,

Was trying out your code today and I can't get the examples to work. I get the following error message:

mydir/node_modules/http-proxy/lib/http-proxy/passes/web-incoming.js:103
    var proxyReq = (options.target.protocol === 'https:' ? https : http).reque
                                  ^
TypeError: Cannot read property 'protocol' of undefined
    at Array.stream [as 3] (mydir/node_modules/http-proxy/lib/http-proxy/passes/web-incoming.js:103:35)
    at ProxyServer.<anonymous> (mydir/node_modules/http-proxy/lib/http-proxy/index.js:83:21)
    at Server.closure (mydir/node_modules/http-proxy/lib/http-proxy/index.js:125:43)
    at Server.EventEmitter.emit (events.js:98:17)
    at HTTPParser.parser.onIncoming (http.js:2108:12)
    at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:121:23)
    at Socket.socket.ondata (http.js:1966:22)
    at TCP.onread (net.js:525:27)

A quick search on Google leads me to http-party/node-http-proxy#499 and http-party/node-http-proxy#510 which seem to indicate that some API change has occurred.

@michaellopez
Copy link
Author

The code in the examples folder does work.

But not the code in the readme. Using the code in the readme or in the examples folder in my own folder gives me the error above. What am I missing? :(

@michaellopez
Copy link
Author

Found the culprit. I was using a http-proxy version that was newer than the one used by harmon.

Maybe this could be mentioned in the readme. That to make require('http-proxy') work you have to npm install http-proxy but that gives you a newer version than harmon uses as a dependency and therefore it does not work. Harmon uses http-proxy 0.8.7

@No9
Copy link
Owner

No9 commented Mar 20, 2014

@michaellopez thanks for the heads up. If you contribute a fix I can give you write access on this repo.

@michaellopez
Copy link
Author

@No9 I will see what I can do. No promises :)

@No9
Copy link
Owner

No9 commented Mar 31, 2014

@No9 No9 reopened this Mar 31, 2014
@Stwissel
Copy link

I'm running into the same issue. What do I need to fix it? See: http://stackoverflow.com/questions/23097898/modifying-html-response-in-node-http-proxy-using-harmon-protocol-error

@michaellopez
Copy link
Author

@Stwissel I'm afraid I can't be of much help. I haven't had time to wrap my head around this issue.

@No9
Copy link
Owner

No9 commented Apr 16, 2014

Opened #9 as the main issue is resolved but there is a header mapping feature required

@No9 No9 closed this as completed Apr 16, 2014
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

3 participants