NodeJS: request piping cloudfront returns binary but not showing image

by iiro   Last Updated September 11, 2019 19:26 PM - source

I have strange problem. I am piping image from S3/Cloudfront. The image is shown ok when put inside img-tag but not directly when opening in browser.

For example this kind of url:

http://localhost:3000/cdn/storage/MyFiles/vBPB27yfHESZfRkCs/original/vBPB27yfHESZfRkCs.jpg

is piped (fake url below)

const url = "https://d28crSOMETHING.cloudfront.net/eyJidWNrZXQiOiJjYXJhd2F5ZXVyb3BlIiwia2V5Ijoic2FsZXNhZHMvd1c3c25iU2I0SmJTUHB4amovVHZaakpUa2hvTkVTN04yc1IuDFanBnIiwiZWRpdHMiOnsicmVzaXplIjp7IndpZHRoIjozMDAwLCJmaXQiOiJvdXRzaWRlIn1=="

request(url).pipe(http.response);

http.response is middleware request instance in https://github.com/VeliovGroup/Meteor-Files

  • Chrome shows image like this enter image description here

  • Firefox shows image

  • Internet Explorer 11 tries to download file. Saved file is correct
  • Edge tries to download file. Saved file is correct

What cloud cause this? Thank you for any help :)

Tags : node.js request


Related Questions



NPM request form keeps returning 415 status

Updated January 09, 2019 21:26 PM

NodeJS Response Has No Body

Updated September 15, 2017 01:26 AM

Node js request huge amount of pictures

Updated January 05, 2019 21:26 PM