title: Display image from S3 by getting URL of the image from mysql database
body: <p>I have a dynamic web project and in this one I try to display elements from a mysql database on an AWS Instance.
  So, in my database, I have many elements (name, city, imageURL) and the imageURL is an URL from an image in an amazon S3.</p>
  
  <p>In my html code, if I put the URL directly, the image is displayed but if I get back the URL from the mysql database (with a javascript function), I got the right url with <code>console.log(imageURL)</code> but the image is not displayed and I have this error :</p>
  
  <pre><code>GET https://s3-us-west-2.amazonaws.com/.... 403 (Forbidden)
  </code></pre>
  
  <p>So do you know why this doesn't work ?</p>
  
  <p>EDIT : This is my javascript code :</p>
  
  <pre><code>var xhttp = new XMLHttpRequest();
  xhttp.onreadystatechange = function() {
  if (this.readyState == 4 &amp;&amp; this.status == 200) {
      myFunction(this);
  }
  };
  xhttp.open("GET", "rest/restaurants", true);
  xhttp.send();
  
  function myFunction(xml) {
      var xmlDoc = xml.responseXML;
      var name;
      var id;
      var imageURL;
      var htmlText = "";
  
  for (i = 0; i&lt; xmlDoc.getElementsByTagName("id").length; i++){
      name = xmlDoc.getElementsByTagName("name")[i].childNodes[0].nodeValue;
      id = xmlDoc.getElementsByTagName("id")[i].childNodes[0].nodeValue;
      imageURL = xmlDoc.getElementsByTagName("imageURL")[i].childNodes[0].nodeValue;
  
      console.log(imageURL);
  
          htmlText = htmlText + 
          "&lt;div class=\"Popular-Restaurants-grid\"&gt;" +
          "&lt;div class=\"col-md-3 restaurent-logo\"&gt;" +
          "&lt;img src="+ imageURL + "class=\"img-responsive\"/&gt;"+
          "&lt;/div&gt;"+
          "&lt;div class=\"col-md-2 restaurent-title\"&gt;"+
          "&lt;div class=\"logo-title\"&gt;"+
          "&lt;h4 id=\"test\"&gt;&lt;a href=\"#\"&gt;" + name + "&lt;/a&gt;&lt;/h4&gt;"+
          "&lt;/div&gt;"+
          "&lt;/div&gt;"    
          }
      document.getElementById("restaurantsContainer").innerHTML = htmlText;
  }
  </code></pre>