node-http-proxy

Persisting a cookie based session over node-http-proxy

℡╲_俬逩灬. 提交于 2019-12-03 17:39:30
问题 I have a simple Express based Node.js web server that I'm using for development of a JavaScript application. I set up the server to use node-http-proxy to proxy API requests the application makes to a Jetty server that is running on a different domain and port. This setup has been working flawlessly until I started to run into problems with session management. Upon authentication the application server returns a cookie with an auth token representing the server session. When I run the JS

Persisting a cookie based session over node-http-proxy

这一生的挚爱 提交于 2019-12-03 06:32:00
I have a simple Express based Node.js web server that I'm using for development of a JavaScript application. I set up the server to use node-http-proxy to proxy API requests the application makes to a Jetty server that is running on a different domain and port. This setup has been working flawlessly until I started to run into problems with session management. Upon authentication the application server returns a cookie with an auth token representing the server session. When I run the JS application off of my filesystem (file://) I can see that once client receives the cookie, it is sent in

Using node http-proxy to proxy websocket connections

有些话、适合烂在心里 提交于 2019-12-02 20:49:41
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'), httpProxy = require('http-proxy'), express = require('express'); // create a server var app = express()

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

三世轮回 提交于 2019-11-30 14:31:14
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) { // append the current chunk of data to the fullBody variable fullBody += chunk.toString(); }); req.on('end',

Node http proxy with proxytable and websockets

只谈情不闲聊 提交于 2019-11-30 13:46:49
I'm trying to get websockets to also work with node-http-proxy . The difference is i'm using a proxytable: var options = { router: { 'a.websterten.com': '127.0.0.1:150', 'b.websterten.com' : '127.0.0.1:151', } }; var server = httpProxy.createServer(options); I tried: server.on('upgrade', function (req, socket, head) { server.proxy.proxyWebSocketRequest(req, socket, head); }); But it doesn't seem to work. A quick check to see whether websockets work shows I get Unexpected response code: 400 from Chrome (works fine if I go directly) Also doing a couple of checks server.on('upgrade',.. doesn't

Accessing webservices from a website which is running behind a proxy

最后都变了- 提交于 2019-11-30 03:50:03
问题 I am designing a website using ember and express over node. Its running in a server, say: SERVER_1. I have few webservices running in another server, say: SERVER_2. That is: website in SERVER_1 and webservices available in SERVER_2 SERVER_1 is behind a proxy server. And I am trying to access webservices from SERVER_1: SERVER_1 =====[PROXY]===> SERVER_2 When I make AJAX webservice calls from SERVER_1, I receive: NetworkError: 500 Internal Server Error However, I am able to retrieve values

nginx vs node-http-proxy

拈花ヽ惹草 提交于 2019-11-29 22:39:59
Tell me please what is preferable to use for deployment of nodejs applications nginx or node-http-proxy. What is most robust? The basic features I need are proxy all requests to non 80 post load balancer Websocket supporting Here is a great article on the subject http://www.exratione.com/2012/07/proxying-websocket-traffic-for-nodejs-the-present-state-of-play/ Personally I have played with a lot of configurations in this realm and it all comes down to what you need and where you need to deploy. If you are on your own hardware (or cloud slice, etc.) and you only need to support Node, then node

Node http proxy with proxytable and websockets

拜拜、爱过 提交于 2019-11-29 19:15:20
问题 I'm trying to get websockets to also work with node-http-proxy . The difference is i'm using a proxytable: var options = { router: { 'a.websterten.com': '127.0.0.1:150', 'b.websterten.com' : '127.0.0.1:151', } }; var server = httpProxy.createServer(options); I tried: server.on('upgrade', function (req, socket, head) { server.proxy.proxyWebSocketRequest(req, socket, head); }); But it doesn't seem to work. A quick check to see whether websockets work shows I get Unexpected response code: 400

Node.js http-proxy drops websocket requests

霸气de小男生 提交于 2019-11-29 05:46:46
问题 Okay, I've spent over a week trying to figure this out to no avail, so if anyone has a clue, you are a hero. This isn't going to be an easy question to answer, unless I am being a dunce. I am using node-http-proxy to proxy sticky sessions to 16 node.js workers running on different ports. I use Socket.IO's Web Sockets to handle a bunch of different types of requests, and use traditional requests as well. When I switched my server over to proxying via node-http-proxy, a new problem crept up in

Node http-proxy and express

怎甘沉沦 提交于 2019-11-28 05:02:19
I'm trying to do something like this: // Setup prox to handle blog requests httpProxy.createServer({ hostnameOnly: true, router: { 'http://localhost': '8080', 'http://localhost/blog': '2368' } }).listen(8000); Previously I was using this: http.createServer(app).listen(app.get('port'), function(){ console.log("Express server listening on port " + app.get('port')); }); Basically, I want to still use express... but, when people go to http://localhost/blog get taken to the blog but still be served over port 8080 (which will eventually be port 80) So I switched it to this and it worked better. The