What is the difference between API gateway reverse proxy and load balancer?
There is no difference between a load balancer and a reverse proxy - they are merely different names for the same thing.
A reverse proxy adds the load balancing/proxying logic to an existing server/application.
The benefits of using a reverse proxy vs a load balancer are as follows: If your application requires HTTP 2 (dual stream) - a reverse proxy is more suitable since it has this capability. You have already deployed your server/application. So there is no reason to start over with a load balancer So in essence: A load balancer is just a reverse proxy with the additional functionality of load balancing and proxying. A reverse proxy is a load balancer that also proxies the request. While I don't know where you are getting this, an API Gateway does not have load balancing capabilities. It's just a normal web server.
Can we use a load balancer and a reverse proxy together?
I'm building a web application that exposes 3 apis, that all talk to each other, in some cases with some redundancy.
The whole thing is running in docker containers and should be very stateless.
I'm setting up the reverse proxy part by having a nginx container which listens on port 8080 (which is accessible from internet) and forward my requests on port 80 and forward a specific url on to my three containers and so far everything is working fine. As I don't have any caching, I guess the only place where there might be some contention will be the database, but as my containers are simple rest webservices, I have them using Postgresql and then just creating a connection pool for that DB (forgot how many queries a second can use that connection anyway). The database can not live in a container, as it has no public IP. When I connect to my postgres container it has ip 172.31.4. When I'm deploying on the cloud (google or azure), a load balancer will add its own public ip as a dns name for my containers IP and that won't work anymore.
My question would be then: how do you handle this? Do you use the load balancer instead of the reverse proxy for the whole thing? This will work perfectly but will create a lot of problems on changing the DNS of my domain. Also, my containers will get the IP from that load balancer instead of what they set in their environment variables.
Another option would be to just have a single container, that runs the whole db thing as well. This is also bad, as every container has some time to startup.
What is the recommended way of doing this? When using a load balancer, make sure that traffic being forwarded by the load balancer goes through your reverse proxy first. Using the nginx example here as an example, configure your reverse proxy to direct requests to the load balancer and not pass them onto the backend service on the docker host.
Is the AWS load balancer a reverse proxy?
I have two application servers behind a load balancer.
Both applications are running on the same EC2 instance (same subnet).
The traffic works perfect for the first one, and for the second one, I get an exception from the API: "No match for host name - -". But when I curl the second server on port 80, everything works great. As far as I know the ELB is working as a reverse proxy. Does this mean that everything from port 80 should be send back to the user by the load balancer? If yes, how can I solve the issue? I'm a bit new to this, so excuse me if there's anything wrong. An ELB doesn't proxy requests, but it has an API for adding an ALB to enable proxying of those requests. You need to create an ALB listener, add your target group to it, and add your service to that.
Can AWS API gateway be used as a reverse proxy?
I have an application behind a load balancer that proxies to different services.
The web server at the application server cannot be changed (because we have to keep using Apache). My colleague is now looking into moving to Amazon's API gateway. I understand that API gateway can act as a reverse proxy in the sense that it will accept incoming requests, and forward them to services based on the rules you define. But is it possible for the gateway to act as a reverse proxy? Or do I have to get a normal load balancer on there?
Yes and yes. First of all, you mention Apache, so I'm assuming that you have some frontend on the server that needs to make calls to either AWS API Gateway or whatever API is exposed by the webapp you mention. This is not a limitation of API Gateway, any web application (or any API provider) that uses HTTPS is able to work as a reverse proxy as well. If you have Apache on your server then that means it has access to request and response headers for SSL/TLS. That makes it a nice fit with API Gateway, but if you really need more control over HTTP responses (ie, set the response MIME to application/json while you already have it set to the expected content-type in response to the request), then you're going to want more control. In this case, API Gateway does not fit the bill.
If you don't need request and response header information but you do want the "magic" of SSL/TLS for the client-side, API Gateway can be your best bet. I'm not too familiar with API Gateway, but if the only reason for choosing API Gateway over another API provider or another web application is to secure the communication for SSL/TLS, then you're good to go. Keep in mind that API Gateway won't really do the full SSL/TLS handshake on the client-side, it'll just forward the traffic to AWS for processing (the same thing a regular load balancer will do), and you won't get a full certificate or encryption, but that shouldn't be a problem unless you expect to have clients accessing your server's APIs outside of your office.
Related Answers
What Is the Purpose of a Reverse Proxy?
In the case of a web server, a load balancer is a computer or network devi...
The key features of a reverse proxy
There's a lot of confusion and mis-infor...
Is a reverse proxy the same as a gateway?
I am a newbie to network and server configuration. I am w...