node-http-proxy

How do I use node.js http-proxy for logging HTTP traffic in a computer?

天涯浪子 提交于 2019-12-30 03:33:33
问题 I am trying to implement the simplest example: var http = require('http'), var httpProxy = require('http-proxy'); httpProxy.createServer(function (req, res, proxy) { // // I would add logging here // proxy.proxyRequest(req, res, { host: 'www.google.com', port: 80 }); }).listen(18000); When I configure my browser to use this proxy and I navigate to www.google.com I receive no response. What is that I am doing wrong? I'm using Windows 7 Chrome 回答1: Here is an simple example how to log requests.

Gulp Browsersync and http-proxy-middleware in offline mode

本秂侑毒 提交于 2019-12-23 16:04:30
问题 Does Browsersync with http-proxy-middleware work offline if I am proxying to a localhost server? I have an angular app deployed at localhost:3000 making requests for an api-server deployed at localhost:8080 . The http requests to the api-server are proxied by Browsersync http-proxy-middleware . Everything works fine if I have internet connection but, if I go offline, I get the following error on gulp console: [HPM] Proxy error: ENOENT localhost:8080/data/pet And on browser console: Failed to

Using node http-proxy to proxy websocket connections

点点圈 提交于 2019-12-20 09:49:07
问题 I have an application that uses websockets via socket.io. For my application I would like to use a separate HTTP server for serving the static content and JavaScript for my application. Therefore, I need to put a proxy in place. I am using node-http-proxy. As a starting point I have my websockets app running on port 8081. I am using the following code to re-direct socket.io communications to this standalone server, while using express to serve the static content: var http = require('http'),

How to use node-http-proxy for HTTP to HTTPS routing?

冷暖自知 提交于 2019-12-18 16:58:30
问题 Here's the module version that I'm using: $ npm list -g | grep proxy ├─┬ http-proxy@0.10.0 A webservice calls into my machine and my task is to proxy the request to a different url and host with an additional query parameter based on the contents of the request's body: var http = require('http'), httpProxy = require('http-proxy') form2json = require('form2json'); httpProxy.createServer(function (req, res, proxy) { // my custom logic var fullBody = ''; req.on('data', function(chunk) { //

How to detect when target server is down in http-proxy?

≡放荡痞女 提交于 2019-12-12 23:54:05
问题 I'm trying to create an internet facing server for a internal node express server that I am running in a windows machine. For this purpose, I have a virtual unix box with ports opened and I am using http-proxy to make a proxy server which redirects request to my internal server. I want to show the users a custom html page if the internal server is down. I have following code (relevant part) running in the virtual unix box: var proxy = httpProxy.createProxyServer({target:'http://'+addr.to[2]+'

Generating tor controlport password

南笙酒味 提交于 2019-12-12 18:38:31
问题 I am using the tor-request node module and am having problems. I have followed all steps and directions I could find, Ive searched every site online and I've restarted my computer. I cant finish my project and really am struggling. I keep getting Double Quote Error . Id appreciate any help. //started tor tor & I generated the password with tor --hash-password "myPasswordHere" | tail -n 1 //I also tried tor --hash-password myPasswordHereWithOutQuotes //torr file ControlPort 9051

EC2 hosted Node.js application - can't remotely connect to port

陌路散爱 提交于 2019-12-12 11:04:48
问题 Update : Turns out the only problem was that I was behind a firewall that blocked some ports, but not 8000. Edit: TL;DR: can't connect to port 9000 remotely, but port 8000 is ok and I don't know why :( I've got this node.js application that's running on port 8000 and another one (http-proxy) running on port 9000 . Running them on my machine is fine, but I have some problems when I put them up on a server ( EC2 instance - I did open the ports in the web console security group [1] ). The

Proxying websockets with single “proxyServer” to multiple targets

懵懂的女人 提交于 2019-12-12 04:37:54
问题 I am developing a nodeJS websocket proxy server. The use case is when a websocket request comes, I will check its credentials, add new headers and then based on its group (from user id) to redirect the websocket connection to its target webscoket server. I found most of the packages (such as node-http-proxy) supports single target. Is there a package supporting multiple targets ? 回答1: From the README of node-http-proxy section, "Setup a stand-alone proxy server with custom server logic": var

Hosting multiple Node.JS applications recognizing subdomains with a proxy server

折月煮酒 提交于 2019-12-11 12:45:36
问题 I am trying to redirect certain subdomains to a specific port on my ubuntu AWS EC2 virtual server. Already tried it with DNS and that wouldn't work so based on the following topics, Default route using node-http-proxy? and How do I use node.js http-proxy for logging HTTP traffic in a computer?, I was trying to create a Node.JS proxy server with logging. That said I mixed it a bit up together (I'm new to Node.JS, still learning) and made the following script: var httpProxy = require('http

I cannot use SNICallback

送分小仙女□ 提交于 2019-12-11 05:38:52
问题 I couldn't manage using SNICallback on createServer function. When I try the below codes I get an error as Missing PFX or certificate + pricate key. How can I solve this issue? var fs = require('fs'), tls = require('tls'), https = require('https'); var certs = { "safe.myDomain.com": { key: fs.readFileSync('../SSL/safe/private/key.pem'), cert: fs.readFileSync('../SSL/safe/certs/cert.pem') }, "api.myDomain.com": { key: fs.readFileSync('../SSL/api/private/key.pem'), cert: fs.readFileSync('../SSL