GithubHelp home page GithubHelp logo

rob--w / cors-anywhere Goto Github PK

View Code? Open in Web Editor NEW
8.3K 107.0 5.7K 231 KB

CORS Anywhere is a NodeJS reverse proxy which adds CORS headers to the proxied request.

License: MIT License

JavaScript 97.09% HTML 2.91%

cors-anywhere's Introduction

Build Status Coverage Status

CORS Anywhere is a NodeJS proxy which adds CORS headers to the proxied request.

The url to proxy is literally taken from the path, validated and proxied. The protocol part of the proxied URI is optional, and defaults to "http". If port 443 is specified, the protocol defaults to "https".

This package does not put any restrictions on the http methods or headers, except for cookies. Requesting user credentials is disallowed. The app can be configured to require a header for proxying a request, for example to avoid a direct visit from the browser.

Example

// Listen on a specific host via the HOST environment variable
var host = process.env.HOST || '0.0.0.0';
// Listen on a specific port via the PORT environment variable
var port = process.env.PORT || 8080;

var cors_proxy = require('cors-anywhere');
cors_proxy.createServer({
    originWhitelist: [], // Allow all origins
    requireHeader: ['origin', 'x-requested-with'],
    removeHeaders: ['cookie', 'cookie2']
}).listen(port, host, function() {
    console.log('Running CORS Anywhere on ' + host + ':' + port);
});

Request examples:

  • http://localhost:8080/http://google.com/ - Google.com with CORS headers
  • http://localhost:8080/google.com - Same as previous.
  • http://localhost:8080/google.com:443 - Proxies https://google.com/
  • http://localhost:8080/ - Shows usage text, as defined in lib/help.txt
  • http://localhost:8080/favicon.ico - Replies 404 Not found

Live examples:

Documentation

Client

To use the API, just prefix the URL with the API URL. Take a look at demo.html for an example. A concise summary of the documentation is provided at lib/help.txt.

Note: as of February 2021, access to the demo server requires an opt-in, see: https://github.com/Rob--W/cors-anywhere/issues/301

If you want to automatically enable cross-domain requests when needed, use the following snippet:

(function() {
    var cors_api_host = 'cors-anywhere.herokuapp.com';
    var cors_api_url = 'https://' + cors_api_host + '/';
    var slice = [].slice;
    var origin = window.location.protocol + '//' + window.location.host;
    var open = XMLHttpRequest.prototype.open;
    XMLHttpRequest.prototype.open = function() {
        var args = slice.call(arguments);
        var targetOrigin = /^https?:\/\/([^\/]+)/i.exec(args[1]);
        if (targetOrigin && targetOrigin[0].toLowerCase() !== origin &&
            targetOrigin[1] !== cors_api_host) {
            args[1] = cors_api_url + args[1];
        }
        return open.apply(this, args);
    };
})();

If you're using jQuery, you can also use the following code instead of the previous one:

jQuery.ajaxPrefilter(function(options) {
    if (options.crossDomain && jQuery.support.cors) {
        options.url = 'https://cors-anywhere.herokuapp.com/' + options.url;
    }
});

Server

The module exports createServer(options), which creates a server that handles proxy requests. The following options are supported:

  • function getProxyForUrl - If set, specifies which intermediate proxy to use for a given URL. If the return value is void, a direct request is sent. The default implementation is proxy-from-env, which respects the standard proxy environment variables (e.g. https_proxy, no_proxy, etc.).
  • array of strings originBlacklist - If set, requests whose origin is listed are blocked.
    Example: ['https://bad.example.com', 'http://bad.example.com']
  • array of strings originWhitelist - If set, requests whose origin is not listed are blocked.
    If this list is empty, all origins are allowed. Example: ['https://good.example.com', 'http://good.example.com']
  • function handleInitialRequest - If set, it is called with the request, response and a parsed URL of the requested destination (null if unavailable). If the function returns true, the request will not be handled further. Then the function is responsible for handling the request. This feature can be used to passively monitor requests, for example for logging (return false).
  • function checkRateLimit - If set, it is called with the origin (string) of the request. If this function returns a non-empty string, the request is rejected and the string is send to the client.
  • boolean redirectSameOrigin - If true, requests to URLs from the same origin will not be proxied but redirected. The primary purpose for this option is to save server resources by delegating the request to the client (since same-origin requests should always succeed, even without proxying).
  • array of strings requireHeader - If set, the request must include this header or the API will refuse to proxy.
    Recommended if you want to prevent users from using the proxy for normal browsing.
    Example: ['Origin', 'X-Requested-With'].
  • array of lowercase strings removeHeaders - Exclude certain headers from being included in the request.
    Example: ["cookie"]
  • dictionary of lowercase strings setHeaders - Set headers for the request (overwrites existing ones).
    Example: {"x-powered-by": "CORS Anywhere"}
  • number corsMaxAge - If set, an Access-Control-Max-Age request header with this value (in seconds) will be added.
    Example: 600 - Allow CORS preflight request to be cached by the browser for 10 minutes.
  • string helpFile - Set the help file (shown at the homepage).
    Example: "myCustomHelpText.txt"

For advanced users, the following options are also provided.

  • httpProxyOptions - Under the hood, http-proxy is used to proxy requests. Use this option if you really need to pass options to http-proxy. The documentation for these options can be found here.
  • httpsOptions - If set, a https.Server will be created. The given options are passed to the https.createServer method.

For even more advanced usage (building upon CORS Anywhere), see the sample code in test/test-examples.js.

Demo server

A public demo of CORS Anywhere is available at https://cors-anywhere.herokuapp.com. This server is only provided so that you can easily and quickly try out CORS Anywhere. To ensure that the service stays available to everyone, the number of requests per period is limited, except for requests from some explicitly whitelisted origins.

Note: as of February 2021, access to the demo server requires an opt-in, see: https://github.com/Rob--W/cors-anywhere/issues/301

If you expect lots of traffic, please host your own instance of CORS Anywhere, and make sure that the CORS Anywhere server only whitelists your site to prevent others from using your instance of CORS Anywhere as an open proxy.

For instance, to run a CORS Anywhere server that accepts any request from some example.com sites on port 8080, use:

export PORT=8080
export CORSANYWHERE_WHITELIST=https://example.com,http://example.com,http://example.com:8080
node server.js

This application can immediately be run on Heroku, see https://devcenter.heroku.com/articles/nodejs for instructions. Note that their Acceptable Use Policy forbids the use of Heroku for operating an open proxy, so make sure that you either enforce a whitelist as shown above, or severly rate-limit the number of requests.

For example, to blacklist abuse.example.com and rate-limit everything to 50 requests per 3 minutes, except for my.example.com and my2.example.com (which may be unlimited), use:

export PORT=8080
export CORSANYWHERE_BLACKLIST=https://abuse.example.com,http://abuse.example.com
export CORSANYWHERE_RATELIMIT='50 3 my.example.com my2.example.com'
node server.js

License

Copyright (C) 2013 - 2021 Rob Wu [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

cors-anywhere's People

Contributors

aklinkert avatar bulk88 avatar callmenoodles avatar gnjack avatar kybernetikos avatar nderkach avatar rob--w avatar rodrigopavezi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cors-anywhere's Issues

Cannot proxy without port and host, options.target or options.router, or proxy handlers

I'm trying to use this and am encountering an error:
I'm hosting this on Modulus.io, and have set up the Package.json to have start: node server.js, with main also set to server.js. server.js is exactly like the file in the repo, except for HOST, which is set by Modulus.

Any idea what I'm doing wrong? I can't even get to the point of calling the doCORSRequest from the HTML because I can't get the server-side to start. Any help appreciated!

/mnt/data/1/node_modules/http-proxy/lib/node-http-proxy.js:122 throw new Error(message);
^
Error: Cannot proxy without port and host, options.target or options.router, or proxy handlers
at Object.exports.createServer (/mnt/data/1/node_modules/http-proxy/lib/node-http-proxy.js:122:11)
at Object.createServer (/mnt/data/1/cors-anywhere.js:325:27)
at Object.<anonymous> (/mnt/data/1/server.js:7:12)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:929:3

PSA: Heroku service change at 15 July 2015 may reduce uptime by 25%

CORS Anywhere is currently hosted at Heroku using the free plan. Currently, this plan offers an uptime of 24/7 if the application is actively used.

As of 1 July 2015, all existing free plans will be "upgraded" to a new free plan that limits the uptime to 18 hours a day (i.e. fo 6 hours a day, CORS Anywhere will be offline). This change has been announced at https://blog.heroku.com/archives/2015/5/7/new-dyno-types-public-beta.

I suggest to self-host CORS Anywhere if uptime is critical.

(To maintain the 24/7 uptime for the existing deployment at cors-anywhere.herokuapp.com, 7$ per month needs to be paid. 84$/year for something that doesn't give me any revenue is a bit too much.)

Connection speed

I ran a quick test, and I noticed that the speed at

allow-any-origin.appspot.com

is much faster. Can anything be done about this?

$ set https://s.ytimg.com/yts/jsbin/html5player-vfl4AMHqP.js

$ time curl -Os -H 'origin: *' https://cors-anywhere.herokuapp.com/$1

real    0m6.159s
user    0m0.093s
sys     0m0.015s

$ time curl -Os -H 'origin: *' https://allow-any-origin.appspot.com/$1

real    0m0.878s
user    0m0.171s
sys     0m0.061s

Automatically follow 301 and 302 redirects at the server for Android

The Android Stock browser seems to abort the request when the server replies with a redirect (https://code.google.com/p/android/issues/detail?id=59474).

Because 301 / 302 are the most common redirects, these redirects should automatically be followed when the Android user agent is detected. These requests can safely be coverted to GET.

To support 307/308, the request payload needs to be buffered, which requires some more work. Considering its rare occurrence, I won't spend time on this part.

Creating own instance of cors-anywhere

Hi I was wondering how I would create my own instance of the cors-anywhere proxy. I have an apache server so I'm not sure what to do with the code and how to run it?

Endless redirect on HTTPS site

First of all, thank you for making your proxy public. It's been a great help in a browser-based application I'm working on that needs to consume linked data. I'm going to talk to my colleagues to see if we can do anything to help with #25.

I noticed a problem today where requesting a certain resource would result an an endless redirect to the same Location as the original request. Here's a test on test-cors.org. This endless redirect does not occur when requesting from the non-HTTPS proxy.

Missing required request header. Must specify one of: origin,x-requested-with

this url fails when I access it from ajax request.

Here is my code.

var x = new XMLHttpRequest();
x.open('GET', 'https://cors-anywhere.herokuapp.com/http://www.thecapitoltheatre.com/files/2016/01/squirrel1.jpg');
//x.setRequestHeader('x-requested-with', 'XMLHTTPREQUEST'); adding this also won't chang anyting.
//x.setRequestHeader('origin', 'http://localhost); if i do this browser throwing exception.(Refused to set unsafe header "origin",in Google Chrome)
x.responseType = 'blob';
x.onload = function () {..........};
x.onerror = function () {........}

cors-anywhere and AWS Lambda

Hello! Has anyone succeeded in settings it up on AWS Lambda and can share some experiences? To me caching comes to mind, of course. However, to me an excellent low-cost use-case to to CORSify prepackaged or legacy APIs.

Cached Access-Control-Allow-Origin trouble

If two different sites try to access the same URL through your Heroku app, the second one will not work (it gets a "Cross-origin image load denied by Cross-Origin Resource Sharing policy." error).

I'm pretty sure this because in

headers['access-control-allow-origin'] = origin === 'null' ? '*' : origin;
you prefer returning a single explicit origin for the "Access-Control-Allow-Origin" header instead of just the wildcard "*". So the browser (at least Chrome 33) caches that header from the first site's request and then it doesn't match the second one's.

I've confirmed that clearing cache fixes the next load, but this isn't a great solution given that this is intended to make CORS "just work". Is there a reason you don't just allow wildcard origin?

How to limit access by target domain and file type?

To limit the attack vector of my (local) cors-anywhere proxy, I want to limit the domains it will ferry requests to, as well as the filetypes. In my specific use case, I want to limit it only to domains under '.gov.il'. How can I go about doing so?

Thanks!

a proxy a day..

Hi!

I have a use-case where I would like to run this package behind a corporate firewall. So I would need the cors-anywhere reverse proxy to go through http(s)://proxy.example.com to fetch from the origin. Is this supported (basically I would want the proxy to pickup the settings in the env variables http_proxy or https_proxy like chrome and other tools do, but setting it explicitly would also be fine.)? Any clues? Your help would be very much appreciated.

how to setup cors-anywhere at our server

Hi,
Please let me know how can i setup the CORS-anywhere setup at our server, I have downloaded the library files and put on the server, do let me know the steps.

Restrict access of public CORS Anywhere demo

The CORS Anywhere demo is hosted at Heroku. I've been informed that the app is causing performance issues on the platform and that hosting an open proxy is against the Acceptable Use Policy:

  1. Use the Service to operate an "open proxy" or any other form of Internet proxy service that is capable of forwarding requests to any End User or third party-supplied Internet host;

I'll be monitoring the traffic in the coming period, and blacklist all origins/destinations that have excessive usage demands, and/or automatically block sites that have more than X requests per Y seconds, unless explicitly whitelisted.

These measures are needed to 1) resolve the performance issues on Heroku platform 2) prevent abuse of the open CORS Anywhere proxy 3) Ensure that the CORS Anywhere demo can continue to operate for (small) sites who want to try out CORS Anywhere before hosting it themselves.

Error: Cannot find module 'http-proxy'

when i try to run server.js on node.js im getting this error:
Error: Cannot find module 'http-proxy'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (C:\Program Files\nodejs\node_modules\cors-anywhere\lib\cors-anywhere.js:6:17)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)

npm ERR! This is most likely a problem with the cors-anywhere package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node server.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs cors-anywhere
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls cors-anywhere
npm ERR! There is likely additional logging output above.

using cors-anywhere to make LinkedIn social share

Hi,

I tried using cors-anywhere to make a LinkedIn social share button to open LinkedIn's share form in a modal popup. However, there is no way that the existing LinkedIn session/cookies get passed through proxy.
Is this even possible, or has anyone tried this at all?

Thanks.

Font with relative path inside css not loaded

Hi I tried the demo, all website assets loaded except the font with relative path inside css not loaded. I use iconmoon font icon and all css and js is bundled, css and js are loaded but the icon font not working

any idea why?
Thanks,

Modifying request origin when hosting at localhost

I am setting up this proxy at localhost to access a REST API that only allows access from certain IP addresses. When I open a local html file (with file:// in the URL) to make a POST request to the API via cors-anywhere, it appears to the API server that I am from 127.0.0.1, which is not a trusted IP address. Is there any way to change the settings in cors-anywhere to make the request as coming from my actual IP address? Thanks for your advice.

Error: connect ECONNREFUSED

Hi, I am trying to setup the CORS-Anywhere server and am facing this problem whenever I try to access a URL

//URL: http://localhost:1337/google.com (I use 8080 for tomcat)
Not found because of proxy error: Error: connect ECONNREFUSED

At first I got the Missing headers message, I tried 2 things:

  • Remove the requireHeader option (ie set it to null)
  • Left the recommended requireHeader as-is and added them in the createServer function

Both of them give the same error as shown above. Any help is appreciated. Thanks.

Add option to set Access-Control-Allow-Origin to echo to request origin

When using CORs with Access-Control-Allow-Credentials:true the Access-Control-Allow-Origin cannot be *. Usual practice is the echo back the the request origin as the allowed origin. It would be good to have some option to do this rather than having to know the origin ahead of time and add it to the whitelist.

https is not working.

Steps to reproduce:

  1. Visit https://robwu.nl/cors-anywhere.html
  2. Enter a https URL, e.g. https://robwu.nl
  3. Observe the following reply:
GET https://robwu.nl
400 Bad Request

<html>
<head><title>400 The plain HTTP request was sent to HTTPS port</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<center>The plain HTTP request was sent to HTTPS port</center>
<hr><center>nginx/1.4.7</center>
</body>
</html>
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->

CORS user credentials

Hi!

I've been enjoying this handy CORS proxy and now I was wondering why requesting user credentials is disallowed as it makes all the requests with withCredentials set to true fail.
I've been playing around adding the header Access-Control-Allow-Credentials without success. However, I believe there must be a way as it is possible to do so with JSONP.
Thanks in advance!

Regards

Changing Referer and Origin headers

Is it possible to change the referer and origin header?

I've tried to do this by delete request.headers['referer']; delete request.headers['origin'];

Please allow to get the size fo files!

Please Allow the Content-Length in Access-Control-Expose-Headers!

Currently ,any try to get the length of a file through your proxy via AJAX result in a Nullvalue.
Just look here for more details.

HEAD /artestras.vo.llnwd.net/v2/am/HBBTV/045326-000-A_EXT_EQ_2_VF-STF_01475234_MP4-1500_AMM-HBBTV_EXTRAIT.mp4 HTTP/1.1
User-Agent: Mozilla/5.0 (compatible; MSIE 11.0; Windows NT 6.1; Win64; x64; Trident/7.0; .NET4.0C; .NET4.0E; InfoPath.3) Opera/12.50 Presto/2.12.378
Host: cors-anywhere.herokuapp.com
Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/webp, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1
Accept-Language: fr-FR,fr;q=0.9,en;q=0.8
Accept-Encoding: gzip, deflate
Referer: http://www.arte.tv/guide/fr/045326-000/de-nouvelles-revelations-sur-stonehenge
Connection: Keep-Alive
DNT: 1
Origin: http://www.arte.tv

HTTP/1.1 200 OK
Connection: keep-alive
X-Request-Url: http://artestras.vo.llnwd.net/v2/am/HBBTV/045326-000-A_EXT_EQ_2_VF-STF_01475234_MP4-1500_AMM-HBBTV_EXTRAIT.mp4
Server: nginx/1.0.12
Content-Type: video/mp4
Accept-Ranges: bytes
X-Agile-Checksum: 1ef7aa3e8ba05a662e632e1df62dd28bb8fd1b90ebb5a9817d787843002b27ec
Age: 2933
Date: Sun, 05 Oct 2014 13:47:31 GMT
Last-Modified: Mon, 22 Sep 2014 14:27:02 GMT
Content-Length: 14504083
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: location,x-request-url,x-final-url
X-Final-Url: http://artestras.vo.llnwd.net/v2/am/HBBTV/045326-000-A_EXT_EQ_2_VF-STF_01475234_MP4-1500_AMM-HBBTV_EXTRAIT.mp4
Via: 1.1 vegur

NetworkError: 404 Not Found

hi

I instal cors-anywhere and http-proxy into local computer but when I make a request :
$.ajax({ type: "GET", url: 'http://localhost:8080/http://google.com/',dataType: "text",
success: function(data){
console.log(data)
},
error: function(request, error, tipo_errore) {
console.log(error)
}
});

I have an error :
"NetworkError: 404 Not Found - http://localhost:8080/http://google.com/?_=1416574536780"
Not found because of proxy error: Error: getaddrinfo EAGAIN

with :

  $.ajax({ type: "GET", url: 'https://cors-anywhere.herokuapp.com/http://google.com/',dataType: "text",
   success: function(data){
       console.log(data)
   },
   error: function(request, error, tipo_errore) {
       console.log(error)
   }

});

works perfect :)

could you helpme ?

Please support HEAD requests!

I need to get the file size of large videos, so I wrote this function :

function GetFileSize(Url){
  var size;
  var ajax = new XMLHttpRequest();
  ajax.onreadystatechange = function () {
    if (this.readyState == this.DONE) {
      size=ajax.getAllResponseHeaders();
      size=parseInt(ajax.getResponseHeader("Content-Length"));
    }
  };
  ajax.open('HEAD', Url, false); // <-- the 'false' makes it synchronous, and the 'HEAD' avoid to download the whole file
  ajax.send(null);
  return size/1048576;
}

which doesn't work, and it appear you don't supportHEADrequests :

HEAD /artestras.vo.llnwd.net/v2/am/HBBTV8730-000-A_SQ_2_VF-STF_01483166_MP4-2200_AMM-HBBTV.mp4 HTTP/1.1
Host: cors-anywhere.herokuapp.com
User-Agent: Mozilla/5.0 (compatible; MSIE 11.0; Windows NT 6.1; Win64; x64; Trident/7.0; .NET4.0C; .NET4.0E; InfoPath.3) Opera/12.50 Presto/2.12.378
Accept: text/html, application/xml;q=0.9, application/xhtml xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1
Accept-Language: en
Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1
Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0
Connection: Keep-Alive, TE
TE: deflate, gzip, chunked, identity, trailers


HTTP/1.1 400 Header required
Server: Cowboy
Connection: keep-alive
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: location,x-request-url,x-final-url
Date: Sun, 05 Oct 2014 02:15:31 GMT
Via: 1.1 vegur

The real site work as expected when it receive the request, but the brother reject the content (because of SOP):

HTTP/1.1 200 OK
Server: nginx/1.0.12
Content-Type: video/mp4
Accept-Ranges: bytes
X-Agile-Checksum: 5914f511b20f4e0563508cf629dfffa9bbe452ec7a64edd27cfb5a01622597ed
Age: 65997
Date: Sun, 05 Oct 2014 02:14:02 GMT
Last-Modified: Sun, 28 Sep 2014 19:42:44 GMT
Content-Length: 1577111989
Connection: keep-alive

Is it like a proxy?

I want to know if is it like a proxy ? or not?
SO it can be blocked by a site and you can't request from that site?
the purpose from using ajax javascript request from a site , to show that the client who request it not a server.

Error on Post Request

Hi, I'm using the proxy for a mobile app with phonegap. I can do the GET request with any problem, but when I'm doing the POST request, the response is the following: "Not found because of proxy error: Error: CERT_HAS_EXPIRED"

The header is this:

24-11-2014 16-58-40

Allow cookies behind flag

Hi!

Thanks for this great little tool you've built. It's been great for us to use as part of a development server.

One little nit for us is the omission of the set-cookie header, because we depend on this for authentication. I understand that you've disallowed this to avoid security issues in production, but since we're using it in a development server we would like to allow it.

Is it possible you could add an option to allow cookies, perhaps hidden behind an obscure flag (e.g. dangerouslyAllowCookies)?

Add option to ignore https certificate validation

Hi,

While trying to connect to a web server with self signed certificates, the connection is refused, because the certificates don't validate.

Can an option to ignore the certificate validation be added?

Regards

Application Error

https://cors-anywhere.herokuapp.com/ appears to be down. Therefore when I make a $.get request I receive an error. Because of the $.get error I then receive an No 'Access-Control-Allow-Origin' error as well. Is anyone else experiencing this? Is there a time frame for it to be fixed?

My own instance doesn't work with certain domains, unlike the demo

I had an old instance of cors-anywhere used for proof of concept. I just found out that it wasn't working with pictures coming from a specific domain. So I updated to the latest version of the repo but this didn't solve the issue.

Is there any settings the demo might have that is not default? I only modified the IP port (because I had to). I am planning obviously to add whitelisted servers. My instance works with images from other domains.

Here a successful example with demo server with an image I am having issues with: http://codepen.io/anon/pen/wgeLwW

Thanks!

Investigate abuse and block URLs

I've noticed that the demo at cors-anywhere.herokuapp.com is often under heavy load. A quick analysis of the log files shows that the service is being abused: someone is hammering the proxy with requests to plusone URLs. This needs further investigation, and might result in the introduction of a blacklist of disallowed URLs.

Note about logging:

  • I use the default logging feature of Heroku, which shows only the last 1500 lines. At the current rate of requests, logs are discarded within 14 seconds.
  • The log format is documented at https://devcenter.heroku.com/articles/logging
  • Logs are only used to counter abuse and performance issues.
  • To get a list of most requested hosts, I used heroku logs --app=cors-anywhere -n 1500 | sed 's@^.\+path="/\(https\?://cors-anywhere.herokuapp.com/\)*https\?://\([^/]\+\)/.\+$@\2@' | sort -rn | uniq -c | grep -v 'bytes=[0-9]\+$' | sort -n

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.