kartikey54 / VaccineAvailabilityNotifier

534 stars 334 forks source link

CloudFront is blocking requests #74

Open rohitkolapkar opened 3 years ago

rohitkolapkar commented 3 years ago

Vaccine availability checker started.

RESPONSE DATA

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>ERROR: The request could not be satisfied</TITLE>
</HEAD><BODY>
<H1>403 ERROR</H1>
<H2>The request could not be satisfied.</H2>
<HR noshade size="1px">
Request blocked.
We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
<BR clear="all">
If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
<BR clear="all">
<HR noshade size="1px">
<PRE>
Generated by cloudfront (CloudFront)
Request ID: IHdc-ukdjPxaoqw6sH7UKF3TZxnpG8v_xmrCL0f1m7eVPL-Q0Wj6Ow==
</PRE>
<ADDRESS>
</ADDRESS>
</BODY></HTML>

RESPONSE STATUS

403

RESPONSE HEADERS

{
  server: 'CloudFront',
  date: 'Fri, 07 May 2021 19:13:59 GMT',
  'content-type': 'text/html',
  'content-length': '919',
  connection: 'close',
  'x-cache': 'Error from cloudfront',
  via: '1.1 a35f3496e12ed4f14d5a938f1d80b6f6.cloudfront.net (CloudFront)',
  'x-amz-cf-pop': 'BOM51-C1',
  'x-amz-cf-id': 'IHdc-ukdjPxaoqw6sH7UKF3TZxnpG8v_xmrCL0f1m7eVPL-Q0Wj6Ow=='
}
catrawalkar commented 3 years ago

Got same error, I then gave proper headers... Got it resolved

devsum1 commented 3 years ago

@catrawalkar can you please provide your headers you are passing in request?

rohitkolapkar commented 3 years ago

@Sumit9896926322 explicitly provide some other User-Agent in headers. It worked for me. I think, axios user agent is blocked by cloudfront.

devsum1 commented 3 years ago

@rohitkolapkar thanks,it worked for me.

sid8840 commented 3 years ago

@rohitkolapkar thanks,it worked for me.

can you provide steps that you have modified to get it worked?

rohitkolapkar commented 3 years ago

@sid8840 Find the configuration for axios call. In headers, add 'User-Agent':'search user agents on google and replace this value'.

devsum1 commented 3 years ago

@rohitkolapkar some of my requests failed with unauthenticated access can you explain why?

CyberSG27 commented 3 years ago

'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36', add this in vaccineNotifier.js in headers

soul0101 commented 3 years ago

This works when I run it on my local machine but throws an error when I use repl.it. Any idea why?

JPRMohnish commented 3 years ago

Got same error, I then gave proper headers... Got it resolved

I am getting same error tried requests it also didn't work. Can you give the headers . I was making a CLI tool for the same. API

debmalyapan53 commented 3 years ago

I passed these headers and it worked. 'Host': 'cdn-api.co-vin.in', 'User-Agent': 'PostmanRuntime/7.26.8'

JPRMohnish commented 3 years ago

THank You so Much it worked !!

sonalsatpute commented 3 years ago

Headers will work.

Just to be a good citizen; don't pull the 10 days continuously 1 day is enough to get the notification or explicit check the date and set the corn job for 5 minutes or so, else they might block your IP considering a denial-of-service (DDoS) attack.