Can you use apache as a reverse proxy?

Can you use apache as a reverse proxy?

I have an existing Apache2 site that I would like to reverse proxy for a new website. The old website serves pages, some static and some dynamic, including a login system (username and password). This new website will do the same. In the past, I would use modproxy with Apache for this.

I'm looking to avoid upgrading to something else (like Nginx) as that's a project in progress and this isn't a new site. I've researched a bit and it appears that there are other solutions, such as this. My question is, can I setup Apache2 to perform the reverse proxy? Or would this be an application in which I would want to implement some type of server side programming?
Thanks! You can use a module called modproxyhttp. Just enable it on your apache server.

Once you have done that you need to change the Listen line in the httpd.conf file in the directory that is running the proxy server.

For example if your new domain is "www.newdomain.com" you need to change the Listen line to:
Listen 80. Then you need to configure modproxyhttp. For example to pass the URL to the backend server you could do this: ProxyPass /. ProxyPassReverse /. You may also need to make sure that the new domain has the appropriate permissions to read the files from the old server (or any other security issues).

How to configure apache as reverse proxy for nodejs app?

There are various ways to run a nodejs app as reverse proxy, I am looking for the simplest method for my own understanding. This is what I want. Myappreverseproxy.com should point to my nodejs app www.com -> The simple way: install lighthttpd and have both applications configured to use it as a reverse proxy, using the usual apache-like URL rewriting. If you'd rather control both apps via Apache directly, you can configure an alias that listens on port 80 and translates a request on port 80 to one on the reverse proxy port (ie 8080) and vice-versa, but you'll need to add Apache configuration for that, which is far more involved than just running two apps on the same port and having Apache handle forwarding/routing.

Does Node js need a reverse proxy?

In the Node js world, there's no "reverse proxy". But there are a lot of options for you to use a proxy, or forward proxy.

For example, if you are using Nginx to be a reverse proxy for your Node server, you can use nginx-proxy. If you are using a HAProxy as a reverse proxy, can also help you forward Node requests. But these two proxies are not really helpful for serving files directly from the nodejs server. They just forward requests from node js to upstream.

What if you want to use a real reverse proxy, something like I've used it on. Let's see how it works. First, we need to add the npm to package.json.

, "dependencies":, "devDependencies": }. And this is a simple proxy server, nothing special about it. It just listen on port 8080, and it forward requests from different IP to some other server. In this case, it simply forward from 127.1:3000 to localhost:3000 .

Then, you just use it in your node application like this, and you can access. Const HttpProxy = require('http-proxy'); const proxy = new HttpProxy.createProxyServer(); proxy.on('error', (err) => ); proxy.on('listening', () => ); proxy.

Related Answers

Can I use socks5 on Android phone?

The only app I have that has a proxy setting is Opera Mini (it'...

Can you run Nodejs on Windows?

As I'm using apache to serve pages, I'm wondering if node js really requir...

Does NodeJS need Apache or Nginx?

I am developing an eCommerce application in Node. Js which makes u...