npm / download-counts

Background jobs and a minimal service for collecting and delivering download counts
329 stars 27 forks source link

Getting 403 Forbidden from npm-stat.com #41

Closed pvorb closed 6 years ago

pvorb commented 6 years ago

Starting today, the service I run, https://npm-stat.com/, receives 403 Forbidden errors when calling the download-counts API (see pvorb/npm-stat.com#57). It looks like you are blocking my site from doing calls to api.npmjs.org.

Can you tell me, if there's a way around this? If you want to get in touch with me, we can either discuss solutions here or in private (paul@vorba.ch).

As you might understand, I'm interested in keeping this service running as it's visited by at least one thousand users each day. The service does each request for a package's download counts at most once per day and persists the numbers in TimescaleDB. But the way you designed your API, I have to do that one request per package, if some counts are missing in the database.

If my site puts too much pressure on your API, maybe there is a way around this by providing a daily dump or something like that, that I can pull once? Just a suggestion, but you have my understanding if that's nothing that'll get much priority.

Here's the exact error page I see:

<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en-US"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en-US"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en-US"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en-US"> <!--<![endif]-->
<head>
<title>Access denied | api.npmjs.org used Cloudflare to restrict access</title>
<meta charset="UTF-8" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
<meta name="robots" content="noindex, nofollow" />
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1" />
<link rel="stylesheet" id="cf_styles-css" href="/cdn-cgi/styles/cf.errors.css" type="text/css" media="screen,projection" />
<!--[if lt IE 9]><link rel="stylesheet" id='cf_styles-ie-css' href="/cdn-cgi/styles/cf.errors.ie.css" type="text/css" media="screen,projection" /><![endif]-->
<style type="text/css">body{margin:0;padding:0}</style>

<!--[if gte IE 10]><!--><script type="text/javascript" src="/cdn-cgi/scripts/zepto.min.js"></script><!--<![endif]-->
<!--[if gte IE 10]><!--><script type="text/javascript" src="/cdn-cgi/scripts/cf.common.js"></script><!--<![endif]-->

</head>
<body>
 <div id="cf-wrapper">
 <div class="cf-alert cf-alert-error cf-cookie-error" id="cookie-alert" data-translate="enable_cookies">Please enable cookies.</div>
 <div id="cf-error-details" class="cf-error-details-wrapper">
 <div class="cf-wrapper cf-header cf-error-overview">
 <h1>
 <span class="cf-error-type" data-translate="error">Error</span>
 <span class="cf-error-code">1010</span>
 <small class="heading-ray-id">Ray ID: 416639be8c796469 &bull; 2018-05-05 21:15:59 UTC</small>
 </h1>
 <h2 class="cf-subheadline">Access denied</h2>
 </div><!-- /.header -->

 <section></section><!-- spacer -->

 <div class="cf-section cf-wrapper">
 <div class="cf-columns two">
 <div class="cf-column">
 <h2 data-translate="what_happened">What happened?</h2>
 <p>The owner of this website (api.npmjs.org) has banned your access based on your browser's signature (416639be8c796469-ua21).</p>
 </div>

 </div>
 </div><!-- /.section -->

 <div class="cf-error-footer cf-wrapper">
 <p>
 <span class="cf-footer-item">Cloudflare Ray ID: <strong>416639be8c796469</strong></span>
 <span class="cf-footer-separator">&bull;</span>
 <span class="cf-footer-item"><span>Your IP</span>: 37.120.165.129</span>
 <span class="cf-footer-separator">&bull;</span>
 <span class="cf-footer-item"><span>Performance &amp; security by</span> <a href="https://www.cloudflare.com/5xx-error-landing?utm_source=error_footer" id="brand_link" target="_blank">Cloudflare</a></span>

 </p>
</div><!-- /.error-footer -->

 </div><!-- /#cf-error-details -->
 </div><!-- /#cf-wrapper -->

 <script type="text/javascript">
 window._cf_translation = {};

</script>

</body>
</html>

Thank you!

jakebolam commented 6 years ago

I'm getting this error just visiting the site from my phone at home.

pvorb commented 6 years ago

Closing as this has been solved in npm/registry#319.