0

I have created API using AWS API gateway and while creating individual GET call selected "Use Lambda Proxy integration", and allow cors on that resource. But after publishing API its works fine I am able to get a response in postman/firefox. But when I used the same API with fetch method then in Chrome it is throwing
"Referrer-Policy: no-referrer-when-downgrade" but the same code is working fine with firefox.

sample code : const response1 = await fetch("https://33222321.execute-api.us-east-1.amazonaws.com/dev/get-activejobs") Error in console Request URL: https://33222321.execute-api.us-east-.amazonaws.com/dev/getarchivedjobs Referrer Policy: no-referrer-when-downgrade

I tried to pass some parameters in fetch combination from here https://hacks.mozilla.org/2016/03/referrer-and-cache-control-apis-for-fetch/ is there any setting I am missing?

The same API works fine if I change with Proxy integration. the expected output is the JSON response from that API.

sideshowbarker
  • 81,827
  • 26
  • 193
  • 197
user3215858
  • 29
  • 1
  • 8
  • _“Referrer Policy: no-referrer-when-downgrade”_ - is that supposed to be the _full_ “error” message? – CBroe May 05 '20 at 13:08
  • No there is no error message, I am expecting JSON response if error that is also part of JSON. – user3215858 May 05 '20 at 14:02
  • You’re not making much sense here. First you say, Chrome was “throwing” something, now you say there is no error at all. So, no clue what the actual _problem_ is even supposed to be here now. Please go read [ask] and [mre], and then edit your question, so that it contains a _proper_ problem description. – CBroe May 05 '20 at 14:03
  • OK, Chrome is throwing error message and this is related to CHROME only, for FF it is working as expected. I have enabled CORS for my API. Still showing "Referrer-Policy: no-referrer-when-downgrade" - this is my problem – user3215858 May 05 '20 at 14:09
  • `Referrer-Policy: no-referrer-when-downgrade` _on its own_ is not an actual error. – CBroe May 05 '20 at 14:10
  • (Plus, `no-referrer-when-downgrade` means no referrer will be send if there is a _downgrade_ in protocols. Since the address you are making the request _to_ is an HTTPS one, that does not even apply here.) – CBroe May 05 '20 at 14:11
  • yes, after reading some documents on AWS, I am also a bit confused but I am getting this only on chrome browser, why this is showing and this is only if I select proxy lambda Proxy integration case only. – user3215858 May 05 '20 at 14:15
  • Thanks for the help, problem is solved, Following is workaround. return { "statusCode": 200, "body": json.dumps({"data": response}), "headers": { "Content-Type" : "application/json", "Access-Control-Allow-Origin" : "*", "Allow" : "GET, OPTIONS, POST", "Access-Control-Allow-Methods" : "GET, OPTIONS, POST", "Access-Control-Allow-Headers" : "*" } } – user3215858 May 05 '20 at 14:23
  • was this ever resolved? seeing same issue with S3 ? – born2net Feb 16 '21 at 18:27

0 Answers0