
Product
Socket Firewall Now Blocks Malicious VS Code and Open VSX Extensions
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.
cache-proxy-server
Advanced tools
A simple HTTP caching proxy server that forwards requests to localhost:3000 with intelligent in-memory caching
A caching proxy server that forwards requests to a target server and caches responses for improved performance.
This proxy server acts as an intermediary between clients and a target server. It caches responses based on the request method, URL, and body, reducing redundant requests to the target server.
npm install -g cache-proxy-server
Then start the server anywhere:
cache-proxy-server
git clone https://github.com/nirtal/cache-server-proxy.git
cd cache-server-proxy
npm install
The proxy server requires two arguments: --from (where the proxy listens) and --target (where requests are forwarded).
cache-proxy-server --from http://localhost:3100 --target http://localhost:3000
Options:
--from <url> - URL to run the proxy server on (required)--target <url> - URL to forward requests to (required)-h, --help - Show help message-v, --version - Show version numberExamples:
# Basic usage with default ports
cache-proxy-server --from http://localhost:3100 --target http://localhost:3000
# Use different ports
cache-proxy-server --from http://localhost:8080 --target http://localhost:3000
# Forward to a remote server
cache-proxy-server --from http://0.0.0.0:3100 --target http://api.example.com
# Forward to a different host and port
cache-proxy-server --from http://localhost:4000 --target http://staging-server:8080
If running from source, you can modify the default values in index.js or use the CLI interface:
# Run with default values (http://localhost:3100 -> http://localhost:3000)
npm start
# Or use node directly
node bin/cli.js --from http://localhost:3100 --target http://localhost:3000
For development with auto-reload:
npm run dev
The proxy server is configured via command-line arguments:
--from <url>: Specifies where the proxy server listens (e.g., http://localhost:3100)--target <url>: Specifies where requests are forwarded (e.g., http://localhost:3000)Both arguments are required when using the CLI. When running from source without arguments, it uses default values:
http://localhost:3100http://localhost:3000You can also use the proxy server as a module in your own code:
import { createProxyServer } from 'cache-proxy-server';
createProxyServer('http://localhost:3100', 'http://localhost:3000');
--from)--target)Cache keys are generated using SHA1 hash of:
{
method: "GET",
url: "/api/endpoint",
body: { ... }
}
Assuming you started the proxy with:
cache-proxy-server --from http://localhost:3100 --target http://localhost:3000
Then make requests:
# First request - proxied to target server
curl http://localhost:3100/api/data
# Second identical request - served from cache
curl http://localhost:3100/api/data
Console output:
[PROXY] GET http://localhost:3000/api/data
[CACHE HIT] GET /api/data
To enable this proxy on client sites, you need to use the Requestly Chrome Extension.
Install Requestly
Configure Script Injection
http://localhost:4200)<script type="text/javascript">
(function() {
// Configure these URLs to match your setup
const originalTarget = "http://localhost:3000"; // The original API server
const proxyUrl = "http://localhost:3100"; // Your proxy server (--from URL)
// Intercept all fetch requests
const originalFetch = window.fetch;
window.fetch = async function(resource, config) {
if (typeof resource === "string" && resource.startsWith(originalTarget)) {
const redirected = resource.replace(originalTarget, proxyUrl);
console.log("[Requestly Redirect] fetch →", redirected);
return originalFetch(redirected, config);
}
return originalFetch(resource, config);
};
// Intercept XMLHttpRequests
const OriginalXHR = window.XMLHttpRequest;
function RedirectedXHR() {
const xhr = new OriginalXHR();
const originalOpen = xhr.open;
xhr.open = function(method, url, ...rest) {
if (url && typeof url === "string" && url.startsWith(originalTarget)) {
const redirected = url.replace(originalTarget, proxyUrl);
console.log("[Requestly Redirect] XHR →", redirected);
return originalOpen.call(this, method, redirected, ...rest);
}
return originalOpen.call(this, method, url, ...rest);
};
return xhr;
}
window.XMLHttpRequest = RedirectedXHR;
// Intercept navigation (window.location etc.)
const originalOpen = window.open;
window.open = function(url, ...args) {
if (url && typeof url === "string" && url.startsWith(originalTarget)) {
url = url.replace(originalTarget, proxyUrl);
console.log("[Requestly Redirect] window.open →", url);
}
return originalOpen.call(window, url, ...args);
};
console.log(`✅ Requestly redirect script loaded: ${originalTarget} → ${proxyUrl}`);
})();
</script>
originalTarget and proxyUrl in the script to match your --target and --from URLsIf the target server is unreachable or returns an error, the proxy will return a 502 Bad Gateway status with error details.
ISC
FAQs
A simple HTTP caching proxy server that forwards requests to localhost:3000 with intelligent in-memory caching
We found that cache-proxy-server demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.

Research
More than 140 Mastra npm packages were compromised in a supply chain attack that used a typosquatted dependency to deliver a cross-platform infostealer during installation.

Research
/Security News
A new npm package tests AI malware scanners with prompt injection, safety-triggering comments, context flooding, and obfuscated JavaScript.