title: How to setup Cloudfront with multiple distributions (one domain and one bucket)?
body: <p>I am trying to setup my cdn to serve resources, which are split in between my S3 bucket and my app server. I have a behaviors set like below :</p>
  
  <pre><code>Precedence : 0     Path Pattern : /ws/*.js -&gt; serve from S3 bucket folder /ws
  Precedence : 1     Path Pattern : /*.js -&gt; serve from app server
  </code></pre>
  
  <p>Requests to <code>http://XXXX.cloudfront.net/test.js</code> works properly, but when i try to load a file in the bucket as <code>http://XXXX.cloudfront.net/ws/test-bucket.js</code> it gives me AccessDenied . I have already set the permissions properly on the bucket and loading it directly from the s3 url works properly.</p>
  
  <p>Any help will be greatly appreciated.</p>