Local Development Media Proxy
A WordPress plugin that proxies media requests from your production site during local development, with advanced cache management.
★ 0stars
0forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/sagartulips/media-proxy/archive/refs/heads/main.zipReadme
Local Development Media Proxy
A WordPress plugin that proxies media requests from your production site during local development, with advanced cache management.
Features
- 🖼️ Media URL Rewriting: Seamless media proxying from production to local
- 🔄 CORS Support: Built-in CORS header management
- 🧹 Smart Cache Control: Multiple cache clearing modes
- ⚡ Auto Cache Busting: Automatic cache invalidation
- ⚙️ Flexible Configuration: Admin panel or wp-config.php constants
Installation
-
Method 1 (WordPress Admin):
- Download the ZIP file
- Go to Plugins → Add New → Upload Plugin
- Upload the ZIP file and activate
-
Method 2 (Manual):
- Upload
local-dev-media-proxyfolder to/wp-content/plugins/ - Activate in WordPress admin
- Upload
-
Method 3 (Git):
cd /wp-content/plugins/ git clone https://your-repo-url/local-dev-media-proxy.git
Configuration
Admin Panel Settings
- Go to Settings → Media Proxy
- Configure:
- Local URL: Your local development URL (e.g.,
https://site.local) - Live URL: Production site URL (e.g.,
https://site.com) - Cache Settings: Choose clearing behavior
- Auto Cache Busting: Enable/disable automatic cache invalidation
- Local URL: Your local development URL (e.g.,
wp-config.php Constants (Alternative)
// Override admin settings
define('LOCAL_DEV_MEDIA_LOCAL_URL', 'https://site.local');
define('LOCAL_DEV_MEDIA_LIVE_URL', 'https://site.com');
define('LOCAL_DEV_MEDIA_ENABLE_CORS', true);
define('LOCAL_DEV_MEDIA_AUTO_CACHE_BUST', true);
Cache Management
Clearing Modes
| Mode | Trigger | Clears |
|---|---|---|
| Media Only | ?clear_key=media |
Media URLs |
| Specific | ?clear_key=media,object |
Selected caches |
| All | ?clear_key=true |
All caches |
Admin Tools
- Quick Clear Buttons: One-click cache clearing
- Admin Bar Shortcut: Clear cache from any page
- Cache Busting: Automatic asset versioning after clears
Troubleshooting
Media Not Loading?
- Verify URLs in settings
- Check browser console for CORS errors
- Clear relevant caches
Cache Not Updating?
- Try different clearing modes
- Check if caching plugins are interfering
- Verify auto cache busting is enabled
Development
# Clone repository
git clone https://your-repo-url/local-dev-media-proxy.git
# Build plugin ZIP
zip -r local-dev-media-proxy.zip local-dev-media-proxy -x "*.git*"
Changelog
1.4
- Added auto cache busting
- Enhanced admin interface
- Improved cache clearing logic
1.3
- Added multiple cache clearing modes
- Admin bar integration
- Better constant handling
License
GPLv2 or later