Advanced Request Routing


Application Load Balancer routes requests to different target groups based on different HTTP method



Use Cases:

There are many use cases where you might want to route HTTP requests to different target groups based on the HTTP methods. For example, you have one target group with low processing power to serve static page for all GET requests. At the same time, you have another target group with high processing power that hosts a web application to handle all the POST requests.



How does this demo work?

1. When you click the “GET” button, a HTTP GET request is sent to the “exampleloadbalancer” demo Application Load Balancer.

2. There are two routing rules configured on the Application Load Balancer.
Rule1: The Application Load Balancer returns a fixed response static page for any GET requests for path /arr_method.
Rule2: The Application Load Balancer routes any POST requests for path /arr_method to a Lambda target group which parses the city data in the POST request and returns the weather information of the given city

3. The HTTP method name that you configured has to be an exact match with the HTTP method in the request.

4. Wildcards are not supported in the match string and method name is case-sensitive.

5. Custom methods are supported. For example you can use method like RENEW, ALLOC, FIND etc. Only upper case alphabets (A-Z), hyphen (-) and underscore ( _ ) are allowed characters in the method name. Examples VERSION-CONTROL, CUSTOM_METHOD, ALLOW etc. The limit on maximum number of characters in method name is 40 and the method name is case-sensitive.

6. There are two routing rules configured to demonstrate how custom HTTP method works.
Rule1: Custom HTTP method is CAT. The Application Load Balancer returns a fixed response static page for any CAT requests for path /arr_method.
Rule2: Custom HTTP method is DOG. The Application Load Balancer returns a fixed response static page for any CDOG requests for path /arr_method.



Route HTTP GET requests to a static page

HTTP Method: GET

Route HTTP Post requests to a Web Application

Please select the city that you want to query for its weather information



Route HTTP request based on customer method

You can use the follow commands to send requests through CAT or DOG custom HTTP method

curl -XCAT https://www.exampleloadbalancer.com/arr_method
curl -XDOG https://www.exampleloadbalancer.com/arr_method

Custom Http Method