edwardspec / mediawiki-aws-s3

Extension:AWS allows MediaWiki to use Amazon S3 (instead of the local directory) to store images.
https://www.mediawiki.org/wiki/Extension:AWS
GNU General Public License v2.0
42 stars 32 forks source link

AWS Cloudfront #73

Closed Tandokude closed 10 months ago

Tandokude commented 10 months ago

Is it possible to utilize this extension with Amazon's Cloudfront to obfuscate the bucket name and possibly allow the bucket/objects to remain private? When I enable the cloudfront url under $wgFileBackends, I still see in the FileOperation log attempts to access $BUCKETNAME.CLOUDFRONTURL/images/x/xx/imagename.jpg , but if i try to browse the original image file i have no issues?

edwardspec commented 10 months ago

Yes, some wikis use it with CloudFront. You just need to set $wgAWSBucketDomain, which is used in the URLs that are provided to the browser.

When I enable the cloudfront url under $wgFileBackends

What exactly are you doing with $wgFileBackends? Nothing needs to be set there.

I still see in the FileOperation log attempts to access $BUCKETNAME.CLOUDFRONTURL

You misconfigured something. Extension needs to talk to S3 directly, not with CloudFront. It's the visitor's browser that is supposed to receive CloudFront URLs.

Tandokude commented 10 months ago

Yes, some wikis use it with CloudFront. You just need to set $wgAWSBucketDomain, which is used in the URLs that are provided to the browser.

When I enable the cloudfront url under $wgFileBackends

What exactly are you doing with $wgFileBackends? Nothing needs to be set there.

I still see in the FileOperation log attempts to access $BUCKETNAME.CLOUDFRONTURL

You misconfigured something. Extension needs to talk to S3 directly, not with CloudFront. It's the visitor's browser that is supposed to receive CloudFront URLs.

Thank you very much, setting just the $wgAWSBucketDomain seems to have resolved the odd issue. I think the $wgFileBackends was a leftover when I was testing every other S3-compatible service and thought it was still needed.