I'm trying to get node-http-proxy working with AppJS. Unfortanly it crashes on launch of the app. What I did:
Edited the app.js window.on(create) function:
window.on('create', function(){ console.log("Window Created"); window.frame.show(); window.frame.center(); window.frame.setMenuBar(menubar); var http = require('http'), httpProxy = require('http-proxy'); // // Create your proxy server and set the target in the options. // httpProxy.createProxyServer({target:'http://localhost:9000'}).listen(8000); // // Create your target server // http.createServer(function (req, res) { res.writeHead(200, { 'Content-Type': 'text/plain' }); res.write('request successfully proxied!' + '\\n' + JSON.stringify(req.headers, true, 2)); res.end(); }).listen(9000); });
When the app starts I want to start the nodeJS proxy server. Is it possible to connect from a external PC to this proxy server? (I know I will need to open ports for this)
For example if I run the app on my home PC and at work I will set the proxy settings of the work PC to homePC_IP:8000. Will this work?
还没有针对node-http-proxy崩溃的修复程序,但是我改为使用https://github.com/TooTallNate/proxy ,它的工作原理很吸引人!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.