Commit Graph

28 Commits

Author SHA1 Message Date
Jack Tench
10df7c9f4a Rename maxAge to corsMaxAge and set the default corsMaxAge to 0.
Set corsAnywhereRequestState before calling withCORS and use the state instead of a parameter to get corsMaxAge.
2017-07-14 12:29:15 +01:00
Jack Tench
881392cfaf Add maxAge config option. If set, an Access-Control-Max-Age header with this value (in seconds) will be added. 2017-07-13 19:13:37 +01:00
Alexander Pinnecke
97c6e53020 Fixed example in README to bind correct host 2017-02-03 15:03:05 +01:00
Rob Wu
6c4234f2b3 Add rate-limiting functionality #45
- Add checkRateLimit option to the API.
- Extend the default server.js with environment variables
  CORSANYWHERE_WHITELIST (re-using originWhitelist) and
  CORSANYWHERE_RATELIMIT (using the new checkRateLimit option)
  to make it easy to enforce usage limits.
- Document that Heroku doesn't want open proxies.
2016-05-31 00:52:26 +02:00
Rob Wu
f07bdc4ea0 Add examples for modifying requests or responses 2016-05-14 23:16:45 +02:00
Rob Wu
e6695b8102 Add redirectSameOrigin
Some clients try to use CORS Anywhere, even for same-origin requests...
Add a new setting "redirectSameOrigin" to not waste server resources on
proxying such requests.

Fixes #42
2016-03-19 18:35:17 +01:00
Rob Wu
bacbbe0cb0 It's 2016
(and remove unnecessary section about Dependencies,
because it mentioned 3x in the previous section and package.json)
2016-02-26 18:26:40 +01:00
rodrigopavezi
9f389e6f41 Added option for a custom help file 2016-02-26 14:16:20 -03:00
Rob Wu
fc9cf157d2 Remove getHandler
It is not supported, and its current form was not documented.
If you need to proxy a request without listening on a port, just
dispatch a 'request' event on the return value of createServer().
2016-02-26 16:21:59 +01:00
Rob Wu
f9af03e762 Add Travis and test coverage
Notes:
- npm run test also runs the memory tests, which might be flaky on
  some systems.
- npm run test-coverage only runs the unit tests (it can't run the
  memory test anyway because the memory tests create a Node child
  process, and istanbul cannot cover that).
2016-02-26 12:38:59 +01:00
Rob Wu
8568c06b17 Support proxying through a proxy - #37
Automatically respects proxy headers from environment variables,
using https://github.com/Rob--W/proxy-from-env
2016-02-19 00:22:20 +01:00
Nikolay Derkach
c5a3877e6c add setHeaders option 2015-08-22 16:49:59 -07:00
Rob Wu
837dee582c Add originBlacklist + originWhitelist
- originWhitelist resolves #24
- originBlacklist may help with #32
2015-08-16 01:05:26 +02:00
Rob Wu
fbf3ce9255 Update copyright year to 2015 2015-05-06 20:15:50 +02:00
Rob Wu
80da247827 Add httpsOptions option to create https.Server
Note: This does not work with the current version of node-http-proxy
and node 0.12.0 because req.connection.pair is not defined.
2015-05-06 12:07:31 +02:00
Rob Wu
4343044781 Default to https for the CORS API.
Heroku uses Strict Transport Security (HSTS), which forces that all
requests to *.herokuapp.com must use HSTS. However. Chrome cannot read
the CORS response after a HSTS redirect due to https://crbug.com/387198.

Since the request is going to be redirected to https anyway, the demo
and the documentation will use https by default.
2014-08-29 19:17:52 +02:00
Rob Wu
c78854e4cf 0.2.0 - upgraded to node-http-proxy 1.3.0
Upgrading fixes the issue that the server crashes when the request
times out (ETIMEDOUT).
2014-08-27 20:16:46 +02:00
Rob Wu
4b308db027 Corrected typo in README
Consequence of error:
- Requests to the CORS anywhere API are prefixed as well, i.e.
  https://cors-anywhere.herokuapp.com/ ->
  https://cors-anywhere.herokuapp.com/https://cors-anywhere.herokuapp.com/

Impact of error:
- Minimal. The functionality of the API is not affected.
2013-09-03 18:08:00 +02:00
Rob Wu
9410ff5afa Remove manual redirect handling
From now on, redirects will automatically be handled by the browser.
Using the API by clients has become extremely easy.

Included JavaScript / jQuery snippets in the documentation to
demonstrate that it's easy to use the API.
2013-08-27 18:51:04 +02:00
Rob Wu
61d55ae41e Avoid preflight request by relaxing header req
One of the following headers is required by default:
- Origin: This header is always sent with CORS requests.
- X-Requested-With: This header is automatically added by jQuery on
  same-origin requests.

These two headers effectively disable the ability to use the CORS
proxy for regular browsing.
2013-08-27 16:15:10 +02:00
Rob Wu
b35a6f5ffb Redirect URL in statusText
Android's stock browser (and Webview) does not recognize the
Access-Control-Expose-headers response header.
Use the status text field to pass through this information.

Updated demo and documentation.
2013-07-23 21:55:32 +02:00
Rob W
ac0cced2f5 Updated README and description 2013-01-05 12:59:57 +01:00
Rob W
051858b480 Location -> X-Location
xhr.getResponseHeader('Location') gives:
> Refused to get unsafe header "Location"
2013-01-04 23:16:38 +01:00
Rob W
544a52b0ff Fix for 3xx redirects; Disabled credentials 2013-01-04 22:46:01 +01:00
Rob W
495a99ebde Docs update, added CORS to some responses. 2013-01-03 22:34:49 +01:00
Rob W
2cf2300afb More documentation and options. 2013-01-03 20:56:25 +01:00
Rob W
b7ba441712 Updated README 2013-01-03 18:55:36 +01:00
Rob W
8a367bda4b CORS Anywhere - Initial commit 2013-01-03 18:46:50 +01:00