You can clone with
The following gist produces a socket.io/socket.io.js 404 (Not Found) error on the browser's side:https://gist.github.com/4324446
socket.io/socket.io.js 404 (Not Found)
This gist does not reproduce that error: https://gist.github.com/4324576
This has nothing to do with node-http-proxy. The /test/ prefix in your html file is wrong: https://gist.github.com/4324446#file-gistfile1-html-L1
Actually, that's what is currently written in the index.html file. I thought I'd revised that gist to the current implementation, but I guess not. This bug was confirmed in the #nodejitsu channel a few nights ago.
Try it without the router. Just do a straight proxy.
@mrryanjohnston What version of node-http-proxy are you using? I think I may have saw something from an old version and gotten confused. Or maybe I was really too tired that night, I was sure I saw a "/" + somewhere. That wouldn't be the first mistake I realized I made that night.
In any case, if you want to come into #nodejitsu again we can try to debug it some more.
@mrryanjohnston I think I know the problem. Try using 'dev.example.com/test/' in the proxy table.
@indexzero The test prefix makes sense. He's requesting the 'dev.example.com/test' thing, so if he doesn't use the '/test/' prefix, it won't route to that express server, thereby not finding that path. The fact that he got that express error shows that it's connecting to the express server, like he wants. It's just due to the way I wrote the URL replacement code. I think we can fix this by adding a '/' at the end of the origin URL if the user didn't add it, or removing the first '/' in the request URL, and adding it back in if it's not there at the end of that transformation process. I think the latter is a better idea.
@mrryanjohnston Can you please try it without the router option when calling httpProxy.createServer()?
Sorry about the delay on this one, guys. Holidays and whatnot :)
@coderarity package.json says "version": "0.8.5". I did try using dev.example.com/test in the routing table, but to no avail. I'll pop back in irc when I'm back from holiday related festivities. Thank you for your patience, once again.
@indexzero If I change the line to the following, the socket.io script is placed at localhost:8080/socket.io/socket.io.js as expected: var proxyServer = httpProxy.createServer(9000, 'localhost').listen(8080);
var proxyServer = httpProxy.createServer(9000, 'localhost').listen(8080);
@mrryanjohnston I suspect this is related to the ProxyTable somewhere. I'll leave this open to investigate, but I won't lie the ProxyTable is not high on my list of priorities.
@mrryanjohnston Heh, that's not the URL I suggested, yo. You've got to use "dev.example.com/test/" (note the ending /). :D
@coderarity So this does two things:
1. You can no longer go to dev.example.com/test in a browser window; only dev.example.com/test/ will work.
2. This produces an error that seems to be on part of socket.io: GET http://dev.example.com/socket.io/1/?t=1357260316641 404 (Not Found). This occurs in socket.io.js on line 1659. Correct me if I'm wrong, but this seems to be an error on part of socket.io.
GET http://dev.example.com/socket.io/1/?t=1357260316641 404 (Not Found)
@coderarity Sorry for the delay on this. Haven't had a chance for fun side-projects for a while :)
I'm currently connecting with an absolute link: var socket = io.connect('http://dev.example.com/test/');
var socket = io.connect('http://dev.example.com/test/');
I understand it's not a super high-priority thing for this project. All the same, thanks for all of your help on this.
Hi, i had the same issue and solved it:
socket = io.connect('http://192.168.1.101:8000');