{"id":15663044,"url":"https://github.com/colinmollenhour/node-caching-proxy","last_synced_at":"2025-08-17T16:13:47.176Z","repository":{"id":6123556,"uuid":"7351704","full_name":"colinmollenhour/node-caching-proxy","owner":"colinmollenhour","description":"A caching reverse proxy powered by Node.js and MongoDb.","archived":false,"fork":false,"pushed_at":"2013-10-29T23:28:07.000Z","size":166,"stargazers_count":19,"open_issues_count":0,"forks_count":4,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-08-14T11:53:48.829Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/colinmollenhour.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-12-28T08:02:27.000Z","updated_at":"2024-06-16T07:48:08.000Z","dependencies_parsed_at":"2022-09-05T19:50:35.929Z","dependency_job_id":null,"html_url":"https://github.com/colinmollenhour/node-caching-proxy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/colinmollenhour/node-caching-proxy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colinmollenhour%2Fnode-caching-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colinmollenhour%2Fnode-caching-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colinmollenhour%2Fnode-caching-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colinmollenhour%2Fnode-caching-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/colinmollenhour","download_url":"https://codeload.github.com/colinmollenhour/node-caching-proxy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colinmollenhour%2Fnode-caching-proxy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270871157,"owners_count":24660145,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-17T02:00:09.016Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-03T13:35:19.456Z","updated_at":"2025-08-17T16:13:47.154Z","avatar_url":"https://github.com/colinmollenhour.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Node.js Caching Reverse HTTP Proxy #\n\ncachingReverseProxy is a connect middleware which reverse-proxies requests to\nan upstream server with full support for RFC2616 protocol and then some.\nIt utilizes MongoDb as the default cache storage backend but could easily be\nextended with other backends.\n\nThe primary feature that sets this caching proxy apart from others is the\nfull support for ETag, Vary and revalidate requests including simultaneous\nstorage for multiple versions of the same page and allowing the origin to\nselect from them with If-None-Match (server-side content-negotiation).\n\n## Status: ALPHA\n\n## Example Application\n``` js\n    var connect = require('connect');\n    var cachingProxy = require('caching-proxy');\n\n    var gatewayErrorApp = connect()\n      .use(connect.logger('errors'))\n      .use(function(req, res) { res.write(\"We'll be right back!\"); });\n\n    var proxyApp = connect()\n      .use(connect.logger('dev'))\n      .use(cachingProxy.createProxy(\n        {\n          debug: false,\n          defaultExpiration: 3600,\n          defaultLifetime: 3600,\n          target: {host: 'app1.example.com', port: 80},\n        //  distribution: 'weighted',\n        //  upstreams: [\n        //    {host: app1.example.com, port: 80, weight: 5},\n        //    {host: app2.example.com, port: 80, weight: 2},\n        //    {host: app3.example.com, port: 80, backup: true},\n        //  ],\n        //  badGateway: gatewayErrorApp,\n        //  gatewayTimeout: gatewayErrorApp\n        },\n        cacheBackend: cachingProxy.backends.mongodb({\n            server: 'mongodb://127.0.0.1:27017/proxy_cache'\n        }\n      );\n\n    var mainApp = connect()\n      .use(connect.vhost('example.com', proxyApp))\n      .use(function(req, res){\n        res.end('Oops!');\n      })\n      .listen(3000);\n```\n## Special (Non-RFC) Features\n\n### X-Accel-Expires (\"off\"|int)\n\nSet to \"off\" to prevent caching, or give a lifetime in seconds for the cache to\nhold the page in storage.\n\n### X-Accel-Cache-Control (cache_control)\n\nIf an X-Accel-Cache-Control header is present it will be used in place of the\nCache-Control header in determining the caching policy. This allows the origin\nto specify a separate Cache-Control header for clients and the proxy.\n\n### X-Accel-Cloak (header_name, ...)\n\nList of headers which should be removed from the response before proxying\nupstream. All X-Accel headers will be removed regardless.\n\n### X-Accel-Vary-Cookie (cookie_name, ...)\n\nWhen used in conjunction with \"Vary: *\" this header tells the proxy which\ncookie value was used to determine the response. Allows simultaneous use of\nETag/Vary and anti-stampeding if the client's identifying cookie is present.\n\n## TODO\n\n - Add anti-stampeding feature (serve stale response when already updating a given page)\n - Add pre-fetching of 503 pages in case upstream becomes unreachable and no stale record exists\n\n## License\n\nThis module is distributed under the GPLv3 license. To receive a copy\nunder a different license please contact the author.\n\nhttp-caching-proxy\nCopyright (C) 2013  Colin Mollenhour (http://colin.mollenhour.com)\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program.  If not, see http://www.gnu.org/licenses/\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcolinmollenhour%2Fnode-caching-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcolinmollenhour%2Fnode-caching-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcolinmollenhour%2Fnode-caching-proxy/lists"}