node.js - AWS + Node/Express: No 'Access-Control-Allow-Origin' for <img> -


i hosting node/express app @ http://www.my-example.com , static contents (images, css, fonts) served bucket named assets amazon s3. images present in images folder inside bucket. have defined following cors bucket:

<?xml version="1.0" encoding="utf-8"?> <corsconfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <corsrule>     <allowedorigin>http://www.my-example.com</allowedorigin>     <allowedmethod>get</allowedmethod>     <maxageseconds>3000</maxageseconds>     <allowedheader>*</allowedheader> </corsrule> <corsrule>     <allowedorigin>*</allowedorigin>     <allowedmethod>get</allowedmethod>     <maxageseconds>3000</maxageseconds>     <allowedheader>authorization</allowedheader> </corsrule> </corsconfiguration> 

i see that,

  1. the server responds xmlhttprequest cannot load https://s3-us-west-1.amazonaws.com/assets/images/... no access control origin header present
  2. this server response present images requested through img tag in html , not other static contents (css/fonts in headers etc)
  3. and, images still rendered correctly on app.

why server selectively sending cross origin response images only? need change express app send 'access-control-allow-origin: "*" header (in spite of configuring s3 bucket) ?

edit

request url: https://s3-us-west-1.amazonaws.com/3dthon/images/social/icons/twitter.png request method: head status: 200 

here request , response headers:

host: s3-us-west-1.amazonaws.com user-agent: mozilla/5.0 (x11; fedora; linux x86_64; rv:37.0)   gecko/20100101 firefox/37.0 accept: */* accept-language: en-us,en;q=0.5 accept-encoding: gzip, deflate referer: http://www.3dthon.com/ origin: http://www.3dthon.com connection: keep-alive 

and

accept-ranges: bytes content-length: 3447 content-type: image/png date: thu, 14 may 2015 16:20:09 gmt etag: "22705eae93b8bbe50f5c81bdf4bac99d" last-modified: thu, 13 mar 2014 19:09:21 gmt server: amazons3 x-amz-id-2:   wri2iitnnyruw91x1khbvctphqcibdumjpb/9bjk04egmxp7nm5sgrorxhj7iv95nsx0tt9wgiq=x-amz-request-id: 9b840aa64cd6b3d2 


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -