Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the point of using a proxy server such as node-http-proxy for a node app with a single app on one port?

I'm exploring using the node-http-proxy proxy server so that I can have our proxy server on port 80 forward requests to our app server on port 8000. However, I'm a little confused as to why this is a good idea, and what exactly this set up would protect against security-wise.

The note-http-proxy documentation discusses a lot about using it as a way to forward requests to an app with multiple ports or ip addresses. This obviously would be very useful, particularly with a basic round-robin load balancer strategy. However, we only have one app on one port, so there is no need for us to do this.

If there is an important security reason why we should be using this proxy-server, then I'd love to know what types of attacks it protects against. Also, we're using socket.io, so if there is something that the proxy does to help the websocket server scale up, I'd like to understand that as well. We're having trouble figuring out how to run our app without sudo (since all ports below 1024 require root access), so if there really is no good reason to use a proxy server at this point, we're just going to scrap at. If anyone knows how to run this app with the proxy server on port 80 without root access, that'd be very helpful as well. Thanks!

like image 558
user730569 Avatar asked May 20 '12 20:05

user730569


People also ask

What is the use of proxy server?

The basic purpose of Proxy servers is to protect the direct connection of Internet clients and internet resources. The proxy server also prevents the identification of the client's IP address when the client makes any request is made to any other servers.

What is node proxy server?

node-http-proxy is an HTTP programmable proxying library that supports websockets. It is suitable for implementing components such as reverse proxies and load balancers.

What is the use of HTTP proxy middleware?

The http-proxy-middleware module does not return a promise, instead it returns an express middleware. You can use a custom filter to decide whether or not to proxy the request. You need to add the pathRewrite options in order to rewrite the url according to the current hostname.

What is the most valuable function of the proxy server?

Proxy servers act as a firewall and web filter, provide shared network connections, and cache data to speed up common requests. A good proxy server keeps users and the internal network protected from the bad stuff that lives out in the wild internet.


1 Answers

The reasons for running a reverse proxy are:

  • You have limited IP ports open and need to run many Node services each of which needs it's own port
  • Your back-end service does not support HTTPS but you need it (e.g. Derby)
  • To add some other feature to the request that cannot be easily done with the back end such as adding Basic Authentication or some form of common logging/auditing
  • To enforce an addition or change to outgoing responses common across several back end services
  • To provide a load-balancing service

Unless your needs are quite simple, it would be better to use a dedicated proxy such as HAproxy since node-http-proxy is rather simplistic.

like image 182
Julian Knight Avatar answered Sep 24 '22 03:09

Julian Knight