If I check a jpeg file in Chrome dev console, here is what I see in the 'Network' tag.
The content-length
is 28479. If I use a 'Save Image' function in browser, the image size is exactly this.
The image file is hosted on an AWS s3 bucket. If I use aws s3 cp
to download the file, I can see the original file size: 50578.
However when I use wget https://files.mycompany.com/abcdefg/thumbnail_large.jpg
, I expected it to come through from cloudflare CDN and hence compressed (ie. 28479). However it is 50578.
-rw-r--r--@ 1 antkong staff 50578 29 Nov 00:58 thumbnail_large_from_wget.jpg
-rw-r--r--@ 1 antkong staff 28479 18 Mar 10:25 thumbnail_large_from_browser.jpg
-rw-r--r-- 1 antkong staff 50578 29 Nov 00:58 thumbnail_large_from_s3.jpg
Why wget
produces a different file size this case?
I have also tried to set the user agent
to the one sent by the browser i.e.
wget -U "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36"
https://files.mycompany.com/abcdefg/thumbnail_large.jpg
. Same result.
Only three fields in the Request headers:
Origin: https://www.mycompany.com
Referer: https://www.mycompany.com
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.3