Skip to content

Instantly share code, notes, and snippets.

@ajwinn
Last active December 19, 2015 09:39
Show Gist options
  • Save ajwinn/5935094 to your computer and use it in GitHub Desktop.
Save ajwinn/5935094 to your computer and use it in GitHub Desktop.
#This index.html is in same directory as ServerOn8888
#Because of proxyOn3333, it attempts loading localhost:3333/jquery-1.7.2.js
#instead of localhost:8888/jquery-1.7.2.js
<html>
<head>
<script src="jquery-1.7.2.js" type="text/javascript"></script>
</head>
</html>
var http = require('http'),
httpProxy = require('http-proxy');
var options = {
pathnameOnly:true,
router: {
'/serverOn8888':'127.0.0.1:8888'
}
}
httpProxy.createServer(options).listen(3333);
#ServerOn8888 Directory Listing
index.html
jquery-1.7.2.js
ServerOn8888.js
var connect = require('connect');
connect.createServer(
connect.static(__dirname)
).listen(8888);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment