express-cors-proxy-server
v0.2.0
Published
A CORS server implemented in Express
Downloads
11
Maintainers
Readme
A CORS proxy server ready to be deployed to Redhat Cloud, Heroku or whatever it is you use.
Built with Node 7, might work with older versions.
Demo
https://corsproxy-alorel.rhcloud.com/
Safeguards
- Non-GET requests are blocked; HTTP 405 is returned.
- Content-Length filtering
- Content-Type filtering
Status endpoints
/stats
Returns a random cluster's stats, for example:
{
"cluster_id": "7cec873c-d2bb-495a-bb06-48568f2423c4",
"rejected": 0,
"approved": 0,
"uptime": 16472,
"uptime_str": "16sec",
"total": 0,
"rejectPCT": 0,
"approvePCT": 0
}
Can be disabled.
/info/gen
Returns some OS info. Can be disabled.
[
{"name":"Node.js Version","value":"7.4.0"},
{"name":"NPM Version","value":"4.1.2\n"},
{"name":"OS Type","value":"Windows_NT"},
{"name":"OS Platform","value":"win32"},
{"name":"OS Architecture","value":"x64"},
{"name":"OS Release","value":"6.1.7601"},
{"name":"CPU Cores","value":8}
]
/info/poll
Returns more server info. Can be disabled.
[
{"name":"Free Memory","value":"783MB"},
{"name":"Uptime","value":"64834.9022395s"}
]
/health
Responds with HTTP 200. Can't be disabled. Required for Redhat Cloud.
Configuration
Edit config.json.
- cache_max_age
- Every request to the proxy results in a HEAD request being made to the target URL to filter out the content type and content length. This is how long these requests are cached for.
- cache_size
- Maximum number of HEAD requests in cache.
- endpoints
- stats
- enable/disable the /stats endpoint
- gen
- enable/disable the /info/gen endpoint
- poll
- enable/disable the /info/poll endpoint
- stats
- headers
- cors
- List of headers to append to CORS requests
- global
- List of headers to append to every request
- cors
- ctypes
- deny
- CORS requests will be rejected if the target resource content-type contains any of these substrings
- allow
- If deny didn't block the request yet, check this array. Only content types containing one of these substrings will be allowed.
- deny