September 2019
Intermediate to advanced
668 pages
15h 59m
English
Let's wrap up by testing the route setup based on the hostname used in the requests!
Normally, the hostname in the request is set automatically in the Host header by the HTTP client. When testing the edge server locally, the hostname will be localhost—that is not so useful when testing hostname-based routing. But we can cheat by specifying another hostname in the Host header in the call to the API. Let's see how this can be done:
curl http://localhost:8080/headerrouting -H "Host: i.feel.lucky:8080"
curl http://localhost:8080/headerrouting -H "Host: im.a.teapot:8080" ...