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?

asked 6 months ago214 views
1 Answer
0
Accepted Answer

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.

answered 6 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions