Uploads Proxy
Uploads Proxy is a WordPress plugin that will automatically download any requested file located in the uploads directory of your production site to your development or staging environment., (*1)
Note: this plugin is currently only tested on WordPress sites built on the excellent Bedrock stack., (*2)
How does it work?
The plugin hooks into the WordPress 404 page and listen for requests to upload files that doesn't exist in the local environment. If possible, the plugin will then download the files from your production site and store them locally, so this whole process is only executed once per file., (*3)
Please note that the plugin only executes if your environment (WP_ENV
) is set to either development
or staging
. No harm is done to your production environment., (*4)
You can simply clear your local uploads directory at any time to restart the whole process., (*5)
Requirements
* The plugin may also work with older versions of WordPress, however I haven't tested it., (*6)
Usage
1. Install and activate the plugin, (*7)
composer require betawax/uploads-proxy
2. Add a constant to your environment configuration(s), (*8)
define('UP_SITEURL', getenv('UP_SITEURL'));
You will want to add this to your config/environments/development.php
and config/environments/staging.php
files., (*9)
3. Define the URL to your production site, (*10)
Add the following line to your local .env
file:, (*11)
UP_SITEURL=http://example.com
4. Profit?, (*12)
Open your local environment in your browser and give it some time to download the files on the first request., (*13)
Credits
This plugin is inspired by the Stage File Proxy Drupal module and basically does the same as the Uploads by Proxy WordPress plugin (which doesn't seem to work with Bedrock)., (*14)
License
Licensed under the MIT license., (*15)