elementor / static-html-output

Static HTML Output Plugin for WordPress
https://statichtmloutput.com
The Unlicense
124 stars 33 forks source link

Issue publishing to a private S3 bucket. #120

Open CrosseyeJack opened 4 years ago

CrosseyeJack commented 4 years ago

These days S3 buckets default to private. If you use CloudFront infront of the bucket (for TLS support, caching support, lambda@edge for redirects etc etc etc) you can choose to leave the bucket private and give CloudFlare access to the bucket.

The issue is even though wp2static s3 addon knows that i'm using https in my Destination URL and/or using a CF invalidation token it will still try and read from the bucket directly instead of trying to access the file via the sites Destination URL resulting in a Failed during "Deploying files to S3", please consult the Help tab for where to get assistance. message.

Enabling public read access on the bucket resolves the issue.

So I propose that either the docs get updated to include this info or the addon get updated to check check the distantion URL instead of the raw s3 bucket url.

I can dig into the code to find the exact place it fails on, but it won't be till later this week/weekend before I will have the time to dig.

leonstafford commented 4 years ago

Hi @CrosseyeJack sorry for slow reply here.

I believe this is the repo that you're currently using, which is a continuation of the "older/classic" version of the plugin.

A more modern approach can be found in https://github.com/WP2Static/wp2static, which has a separate S3 addon plugin, with some flexibility in setting the object's ACL, such as introduced in this commit: https://github.com/WP2Static/wp2static-addon-s3/commit/08c99a4f94424a17fb52fb542d9fb95fd3ff3796

There are quite a few differences between the 2 plugins though, so may not be a quick swap over for your workflow.