udx / wp-stateless

WP-Stateless is a WordPress plugin that uploads and serves your WordPress media from Google Cloud Storage.
https://stateless.udx.io
MIT License
260 stars 64 forks source link

403 Forbidden Error issues with multisite and Polylang Pro #591

Open jptiilik opened 3 years ago

jptiilik commented 3 years ago

Thanks for the great plugin. We are using WP-Stateless on several multilingual multisite installations with Polylang Pro.

Recently however, we have started to experience some issues with it. Things start to get weird when a third language is installed. Then, upon image upload to the media library, the first two language versions work fine but the image for the third language version is grayed out / missing, and the console displays 403 Forbidden Error for it.

Maybe permission issue with a bucket - any ideas where to start digging?

meta media

antonkorotkov commented 3 years ago

Please, check if those files are set to be publicly accessible in GCS.

jptiilik commented 3 years ago

Uploaded files are not accessible right away. Only after using the Regenerate and Sync with GCS functionality they get working URLs. On upload the URLs are generated with wrong (main site) domain and accessing them results an 403.

For example:

URL after an initial upload: https://www.cursor.fi/uploads/sites/9/2020/12/009a1bb6-tree-scaled.jpg - Not accessible (403)

URL after running the Regenerate and Sync with GCS: https://www.visitkotkahamina.fi/uploads/2020/12/009a1bb6-tree-scaled.jpg - Works fine

zchernicky commented 3 years ago

I'm experiencing a similar issue that only gets resolved after selecting "Regenerate and Sync with GCS". I'm using WP-Stateless in conjunction with ShortPixel Image Optimizer. WP-Stateless is in Ephemeral mode, the GCS bucket is publicly accessible, and the ShortPixel Image Optimizer option is enabled. I only started experiencing this issue recently, have had no issues with these two plugins for several months.

jptiilik commented 3 years ago

Please, check if those files are set to be publicly accessible in GCS.

I put the URLs above. Is there anything else to check besides this?

Could it be an issue with Polylang? Would it be possible for you to try to replicate the bug to make sure of this?

Hooace commented 3 years ago

If folder is set to multisite settings like /site/x/year/month, this will happen. If however you are running a multisite and set folder structure as single site, the third image path is correct BUT only when uploading from multisite's main site. For all other sites the third image will point to main site's URL and does not work. This can be fixed by regenerating and syncing.