Skip to content

Node http transparent proxy with in memory caching.

License

Notifications You must be signed in to change notification settings

prepair/api-get-cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

API GET cache

Node http transparent proxy with in memory caching for GET calls.

env vars (nodemon.json)

{
  "env": {
    "TARGET": "https://cms.dev.webdev.local",
    "MAX_WAIT_TIME": 1000,
    "TTL": 5000,

    "PORT": 4000,
    "HTTPS_PORT": 4002,
    "HTTPS_KEY": "/foo/bar/ca.key",
    "HTTPS_CERT": "/foo/bar/ca.crt",
    "CONTENT_BLACKLIST": "<h1>We'll be back shortly</h1>|<p>Temporarily unavailable due to maintenance</p>|>Initialization failed</h1>"
  }
}
  • SSL section (cert, key, https_port) is optional.
  • TTL is the cache item ttl in msec
  • CONTENT_BLACKLIST is a pipe separated list of strings

usage

  1. npm i
  2. create nodemon.json
  3. npm run dev
  4. add prepair.dev as 127.0.0.1 to your hosts file
  5. example url: https://prepair.dev:4002/api/resources/en-gb/commonresources?package=prepair

internal api

All endpoints are GET, now we have a help page at /__help example

TODO

  • fix unzip/rezip
  • store good, but slow responses in cache even if we returned smg else already
  • option to cache non-GET responses?
  • __stat endpoint

About

Node http transparent proxy with in memory caching.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published