This demo showcases how to use an Nginx Reverse Proxy component to hide implementation details about which servers respond to which requests. It acts like a "programming interface".
- Run
docker compose up -d
(make sure that port 8080 is open) - Run
curl http://localhost:8080
. This will show the/static/index.html
file - Change the
/static/index.html
to another thing - Run
curl http://localhost:8080
and see how the file changed - Run
curl http://localhost:8080/somethingElse
and see the custom 404 error site - Run
curl http://localhost:8080/service-1
to see that the request is redirected to the container called "service-1" - Run
curl http://localhost:8080/service-2
to see that the request is redirected to the container called "service-2" - Run
curl http://localhost:8080/service-12
to see that the/static/service-12/index.html
file is shown - Run
docker compose down service1
andcurl http://localhost:8080/service-1
to see a 502 Bad Gateway error.