title: How to use "temporaryUrl" with custom cname in Laravel::Storage with Amazon S3 -> CloudFront and using a Cname
body: <p>I have a file in S3, that with CloudFront using a cname (with amazon SSL Certificate) while the file is public I can access it without problems using the URL.</p>
  
  <p>Valid examples in public files:</p>
  
  <pre><code>https://xxxxxxxxxxxxx.cloudfront.net/media/logos/logo1.png
  https://cdn.{mydomain.com}/media/logos/logo1.png
  https://s3.amazonaws.com/{mys3bucketname}/media/logos/logo1.png
  </code></pre>
  
  <p>In laravel  </p>
  
  <pre><code>$disk = Storage::disk('cnames3');
  $tempUrl = $disk-&gt;temporaryUrl($file, now()-&gt;addMinutes(5));
  </code></pre>
  
  <p>The best option I found was:
  <a href="https://stackoverflow.com/questions/51586344/should-i-use-cloudfront-together-as-temporaryurl-for-sensitive-files-in-s3">Should I use CloudFront together as TemporaryUrl for sensitive files in s3</a></p>
  
  <pre><code>'cnames3' =&gt; [
          'driver' =&gt; 's3',
          'key' =&gt; env('AWS_ACCESS_KEY_ID'),
          'secret' =&gt; env('AWS_SECRET_ACCESS_KEY'),
          'region' =&gt; env('AWS_DEFAULT_REGION'),
          'bucket' =&gt; env('AWS_BUCKET'),
          'url' =&gt; env('AWS_URL'),
          'endpoint' =&gt; env('AWS_ENDPOINT'),
  ]
  
  =====
  .env
  AWS_BUCKET={mys3bucketname}
  AWS_ENDPOINT=https://xxxxxxxxxxxxx.cloudfront.net
  AWS_URL=https://cdn.{mydomain.com}
  </code></pre>
  
  <p>but the URL that I produced includes the name of the bucket, and so it does not work for me, since it denies me access.</p>
  
  <pre><code>https://cdn.{mydomain.com}/{mys3bucketname}/media/logos/logoprivate.png?{params}
  </code></pre>
  
  <p><strong>how can I get a URL compatible with CNAME, or what can I do so I can use my own domain with signed URLs; I look for this format:</strong></p>
  
  <pre><code>https://cdn.{mydomain.com}/media/logos/logoprivate.png?{params}
  </code></pre>
  
  <p>if I have the private file and use "temporaryUrl" without endpoint
  it returns a valid url:</p>
  
  <pre><code> https://s3.amazonaws.com/{mys3bucketname}/media/logos/logoprivate.png?{params}
  </code></pre>
  
  <p>but without my domain, which does not work for me, I have been looking for a solution for hours, I hope you can help this beginner in the subject </p>