generoi/bedrock

Find a Stage File Proxy alternative

Closed this issue ยท 7 comments

oxyc commented

https://www.drupal.org/project/stage_file_proxy is legendary. We need to find a replacement for WP but none have been used in ages. If we drop Timber this will be way easier to implement.

uploads-by-proxy seems not to work with multisite? but I can't see the others mention it
https://plugins.trac.wordpress.org/browser/uploads-by-proxy/trunk/class-helpers.php#L30

oxyc commented

and https://github.com/alleyinteractive/stage-file-proxy/blob/master/stage-file-proxy.php#L41 hardcodes wp-content/uploads and overall looks quite odd...

Which leaves https://plugins.trac.wordpress.org/browser/stage-file-proxy/trunk/stage-file-proxy.php#L107 that's looks like it's essentially enough (made by a drupal developer rather than a wp one of course ๐Ÿ˜„). Maybe we could just add it as our own mu-plugin as it's unmaintained anyways and we might need to adjust things. No need for an admin page I think.

Just check if UPLOADS_PROXY is set to a URL and we're in development mode, then proceed. Probably good to keep both redirect and download options as redirect is nice for a fast default but download can be useful for more advanced use cases.

yeah it being unmaintained is a bit of a deal-breaker. and i agree we don't need an admin page

This sounds good.
some thoughts though (after only having checked out the last link)

The redirect option seems to be less performant than having it in .htaccess.
stage-file-proxy seems to do the redirect in the _template_redirect_ action and checking if _is_404_.
I wonder how far the wp bootstrap process has gone by this and how it would affect the site if we were to load many images if wp bootstraps for each image. I browser cache takes care of it though if enabled.

With the download option the images would be downloaded to uploads folder.

the stage_file_procy seems nice for drupal

Stage File Proxy integrates with imagecache to transfer the original image from the origin and then resize it locally.

Should we have something similar to this as well?

oxyc commented

I wonder how far the wp bootstrap process has gone by this and how it would affect the site if we were to load many images if wp bootstraps for each image. I browser cache takes care of it though if enabled.

True, it's gone pretty far. I bet it would kill mbmobile and teritalot gallery pages for sure. And so would the download option. We can add the .htaccess redirect as commented out example.

oxyc commented

Doesnt really work, the nginx hack is good enough, closing in favor of #245