September 2019
Intermediate to advanced
668 pages
15h 59m
English
To learn a bit more about the routing capabilities in Spring Cloud Gateway, we will try out host-based routing; that is, where Spring Cloud Gateway uses the hostname of the incoming request to determine where to route the request. We will use one of my favorite websites for testing HTTP codes: http://httpstat.us/.
A call to http://httpstat.us/${CODE} simply returns a response with the ${CODE} HTTP code and a response body containing the HTTP code and a corresponding descriptive text. For example, see the following curl command:
curl http://httpstat.us/200 -i
This will return the HTTP code 200, and a response body with the text, 200 OK.
Let's assume that we want to route calls to http://${hostname}:8080/headerrouting ...