requests-proxy

requests-proxy is a NodeJS proxy server that adds request/response headers to the proxied request.

It allow you to append/remove request and response headers as you want to.

How to use?

Just send a request to https://yourproxydomain.com/proxy and the following supported queries:

  • url (Required) – Proxy target. Note: URL must be encoded to work correctly
  • ignoreReqHeaders – If set, the request headers sent from browser will be ignore. Example: ignoreReqHeaders=true
  • followRedirect – Follow redirect if true, otherwise send raw redirect response. Example: followRedirect=true
  • redirectWithProxy – If set, the server will add proxy to the redirect location. Example: redirectWithProxy=true
  • decompress – If set, no decompress would be done. return back the non-compressed response. Example: decompress=true
  • appendReqHeaders – If set, these headers will be appended to the request headers. Note: It will override the header if it exists. Example: appendReqHeaders=[["referer": "https://google.com"], ["origin": "https://google.com"]]
  • appendResHeaders – If set, these headers will be appended to the response headers. Example: appendResHeaders=[["content-type": "text/plain"]]
  • deleteReqHeaders – If set, these headers will be removed from the request headers. Example: deleteReqHeaders=["origin"]
  • deleteResHeaders – If set, these headers will be removed from the response headers. Example: deleteResHeaders=["set-cookie"]

CORS applied to * by default, you can override it with appendReqHeaders

Install

git clone https://github.com/hoangvu12/requests-proxy
cd requests-proxy
npm install
npm start

Example

  • http://yourproxydomain.com/proxy?url=http%3A%2F%2Fgoogle.com – Google.com with CORS headers

  • http://yourproxydomain.com/proxy?url=http%3A%2F%2Fgoogle.com&appendResHeaders=[["content-type": "text/plain"]] – Request Google.com as text

  • http://yourproxydomain.com/proxy?url=http%3A%2F%2Fgoogle.com&deleteResHeaders=["set-cookie"] – Remove Google.com cookies

Similiars

Thank you

@jimmywarting – A great gist about CORS Proxies

GitHub

View Github