What is difference between reverse proxy and API gateway?
Basically, API Gateway is like a gateway or a firewall that sits between client app (mobile phone, web browser etc.) and the backend cloud service like AWS, Azure and Google.
In reverse proxy, HTTP request from client hits the gateway (firewall) and the request is then forwarded to the backend cloud service. In API Gateway, it handles HTTP request and response of the client applications (mobile app or web browser).
For your understanding let's look at an example : Client (HTTP Request from mobile phone browser - Mobile app/web browser) -> API Gateway (for Android users). API Gateway (HTTP Request from android app user - Mobile app or web browser) -> Reverse Proxy (for Android users) -> REST API of the cloud service(aws service). In this image, when you visit website of the company A, your request (mobile app/web browser) will be handled by API Gateway which then will reach the reverse proxy which then will deliver the call to the backend service. The difference between reverse proxy and API gateway is more on architecture and deployment and less on actual code/script.
Does AWS have reverse proxy?
How would I make requests from my external URL to AWS EC2 instances?
I have an example of my external URL and a script which creates a new EC2 instance. ,
"KeyName":null.
Here is the script: The problem is that when I run the script it works perfectly but when I try to request the IP address from the external URL I get a 500 error. Yes you need a reverse proxy. You can create your own reverse proxy using Nginx or HAproxy.
AWS has two types of reverse proxies. One is ELB where you put a listener on your app on the external URL and the second one is EC2 instances where you run an instance of Nginx or HAproxy and your web server on the instance.
EC2 Instances are easier to setup.
Can API gateway be used as a proxy?
If possible, can I send JSON back and forth between the client and server through the gateway? eg In client - POST request to server /api/login -> JSON is sent to gateway -. <- JSON is returned to the client. In server - request to gateway - <- is sent back to the client. Yes you can build a proxy (reverse proxy in HTTP terminology) using an API Gateway. Here is a blog post that explains the details.
Yes your description is correct with the few exceptions below. When talking about the API Gateway, you will have a service that can act as a proxy server to communicate with resources on your target back end. Answering your 3 questions: API Gateway as proxy? Yes, you can do it. There are examples of using API Gateway as reverse proxy in Google AppEngine and Azure AppFabric JSON? You are correct with the way you have described it in the example. However keep in mind that this can only work for SOAP (or HTTP) resources where the input and output messages are text. This cannot work for binary payloads. This will require you to build different logic to handle the different MIME types for different services
Request -> Response yes if you want, but then this is how most applications work. For example in Go HTTP clients do not actually send HTTP requests as such. They have an http.Request type that you use to initiate the request. The underlying implementation in most HTTP libraries involves sending a Request to the server with some headers added. Then the server responds with either a 200 status code or a 300 for "invalid request" (I am generalizing, in reality there are multiple reasons why the server could return 200).
Can AWS API gateway be used as a reverse proxy?
Amazon Web Services recently launched the API gateway service which allows you to host a separate application on their platform, called API gateway, which will be accessible by clients over HTTP.
It seems as though a great use for API gateway is to function as a reverse proxy, that is to have a web server in front of an app, to forward requests to the backend app (usually API backend) and to send the responses back to the client. The example usage they give is to have a static page hosted at api.myapp.com which would have the following endpoints: /users/list, /users/show/1234. For simplicity sake, assume each route returns a JSON response.
As an experiment, I created the following application which I expect might serve as a useful proof of concept for what can be done with the service.
Related Answers
Is a reverse proxy the same as a gateway?
I am a newbie to network and server configuration. I am w...
What are the two types of proxies?
You can use a reverse proxy for multiple reasons, but mostly it is us...
What is API gateway responsible for as reverse proxy?
Amazon's Elastic Load Balancing offers the ability to set up HTTP and HT...