Caching Proxy

Build a caching server that caches responses from other servers.

Start building, submit solution and get feedback from the community.
2Submit Solutionยท
5 upvotes10 upvotes

You are required to build a CLI tool that starts a caching proxy server, it will forward requests to the actual server and cache the responses. If the same request is made again, it will return the cached response instead of forwarding the request to the server.

Requirements

User should be able to start the caching proxy server by running a command like following:

caching-proxy --port <number> --origin <url>
  • --port is the port on which the caching proxy server will run.
  • --origin is the URL of the server to which the requests will be forwarded.

For example, if the user runs the following command:

caching-proxy --port 3000 --origin http://dummyjson.com

The caching proxy server should start on port 3000 and forward requests to http://dummyjson.com.

Taking the above example, if the user makes a request to http://localhost:3000/products, the caching proxy server should forward the request to http://dummyjson.com/products, return the response along with headers and cache the response. Also, add the headers to the response that indicate whether the response is from the cache or the server.

# If the response is from the cache
X-Cache: HIT

# If the response is from the origin server
X-Cache: MISS

If the same request is made again, the caching proxy server should return the cached response instead of forwarding the request to the server.

You should also provide a way to clear the cache by running a command like following:

caching-proxy --clear-cache

After building the above project, you should have a good understanding of how caching works and how you can build a caching proxy server to cache responses from other servers.

Found a mistake? Help us improve.

Actively Maintained

We are always improving our content, adding new resources and adding features to enhance your learning experience.

Join the Community

roadmap.sh is the 7th most starred project on GitHub and is visited by hundreds of thousands of developers every month.

Rank 7th  out of 28M!

298K

GitHub Stars

Star us on GitHub
Help us reach #1

+90k every month

+1M

Registered Users

Register yourself
Commit to your growth

+1.5k every month

29K

Discord Members

Join on Discord
Join the community

Roadmaps Best Practices Guides Videos FAQs YouTube

roadmap.sh by @kamrify

Community created roadmaps, best practices, projects, articles, resources and journeys to help you choose your path and grow in your career.

© roadmap.sh · Terms · Privacy · Advertise ·

ThewNewStack

The top DevOps resource for Kubernetes, cloud-native computing, and large-scale development and deployment.