Pretty simple sample of nginx used as reverse proxy with cache with Redis for a backend app. All running on docker compose
All HTTP requests coming from the callers will go thru Ngnix.
Nginx uses OpenResty Lua Module to look for the request's response on Redis Cache with OpenResty Lua Redis, if it is a cache hit it will contest the request with appropriate cache entry based on its $key.
Otherwise, if the data is still not cached, Nginx will pass the request as-is to the backend and will store the backend's response on the cache, for the next requests, before sending it back to the caller.
docker-compose build
docker-compose up
curl -v http://localhost/cached