title: Amazon CloudFront setup with custom domain name
body: <p>I have an application which serves assets under the following URL:</p>
  
  <pre><code>https://example.com/assets/...
  </code></pre>
  
  <p>Now I want to use Amazon CloudFront to serve these assets with the URL </p>
  
  <pre><code>https://cdn.example.com/assets/...
  </code></pre>
  
  <hr>
  
  <p><strong>The things I have done:</strong></p>
  
  <ol>
  <li>I created a new distribution with the origin of <code>cdn.example.com</code></li>
  <li>I added a <code>CNAME</code> DNS record pointing <code>cdn.example.com</code> to <code>example.com</code></li>
  </ol>
  
  <hr>
  
  <p>Now I feel like that configuration does not serve the assets via CloudFront. Instead if I request my CloudFront Domain Name, lets say <code>dpw02sdffky7p.cloudfront.net</code>, I get redirected to <code>example.com</code>. So it feels like my assets are still being served from my server, just with some redirects in between.</p>
  
  <p>Am I right? What would be the correct configuration to achieve my goal?</p>