Cloudfront signed urls with alternative domain name

0

I've setup Cloudfront and AWS and I've created a separate Behaviour with Restricted View Access and and in my app I'm using CloudFrontUrlSigner from the Java API to sign urls like this:

return CloudFrontUrlSigner.getSignedURLWithCannedPolicy('https://d2q5345wrel4pb8.cloudfront.net/test.jpeg', backendProperties.getAws().getKeyId(), keyFactory.generatePrivate(keySpec), cal.getTime());

and this works fine - I am able to open the url in the browser, the parameters are there and everything works fine.

Now I've also added one entry in Alternative Domain Names: cdn.mycompany.com, and so I try to sign the URL again with the same code:

return CloudFrontUrlSigner.getSignedURLWithCannedPolicy('https://cdn.mycompany.com/test.jpeg', backendProperties.getAws().getKeyId(), keyFactory.generatePrivate(keySpec), cal.getTime());

but the url in the browser says:


<Error>
<Code>AccessDenied</Code>
<Message>Access denied</Message>
</Error>

What am I missing?

已提問 7 個月前檢視次數 236 次
1 個回答
0
已接受的答案

So I figured it out. My cdn.mycompany.com CNAME record in Cloudflare had Proxied=TRUE. Once I set it to FALSE it started to work fine.

已回答 7 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南