Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

caching-proxy

A simple HTTP caching reverse proxy server built with Node.js and Express.

Overview

caching-proxy acts as a caching layer in front of your origin server. It efficiently caches GET requests for faster subsequent responses while forwarding other requests to the original backend. This project is designed for learning about HTTP caching, proxies, and middleware in Node.js.

Features

  • Caches GET responses to reduce latency and load on the origin server.
  • Supports custom cache TTL (time-to-live).
  • Forwards all HTTP methods to the origin if not cached.
  • Stores and returns response headers.
  • Adds an X-Cache header to show cache HIT or MISS.
  • Easy to configure and extend.

Getting Started

  1. Clone the repository:

    git clone https://github.com/your-username/caching-proxy.git
    cd caching-proxy
  2. Install dependencies:

    npm install
  3. Build the project:

    npm run build
  4. Link the executable globally (for development/testing):

    npm link
  5. Run the caching proxy via CLI:

    caching-server --origin  http://example.com --port 8080

    Replace http://example.com with your origin server URL, and 8080 with your desired port.

Usage

Once running, send your API requests to http://localhost:8080 (or your chosen port). The proxy will forward and cache responses from the specified origin server.

Project Task

See the full project and learning roadmap at:
https://roadmap.sh/projects/caching-server

Contributing

Contributions are welcome! Fork the repo and submit a pull request for improvements.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages