Setting Up PrestaShop Image Proxy
This guide explains how to set up and configure the image proxy feature for PrestaShop, which allows you to serve images from a remote domain through your local development environment.
Overviewβ
The image proxy feature in PrestaShop allows you to proxy images from a production or staging server to your local development environment. This is useful when you want to work with real product images without downloading them all locally.
Prerequisitesβ
- A PrestaShop application created with DevSpaces
- Access to the remote domain containing the images you want to proxy
Checking Image Proxy Statusβ
First, check the current status of the image proxy:
dvs img-proxy status
This will show whether the image proxy is enabled or disabled.
Enabling Image Proxyβ
Step 1: Set the Domainβ
Before enabling the image proxy, you need to specify the remote domain:
dvs img-proxy set-domain example.com
Replace example.com with the domain of your production or staging server.
Step 2: Enable the Proxyβ
Enable the image proxy:
dvs img-proxy enable
This will:
- Configure Apache to proxy image requests
- Reload the Apache configuration
- Start proxying images from the specified domain
Disabling Image Proxyβ
To disable the image proxy:
dvs img-proxy disable
This will stop proxying images and serve local images only.
Toggling Image Proxyβ
You can quickly toggle the image proxy on/off:
dvs img-proxy toggle
This will switch between enabled and disabled states.
Changing the Domainβ
To change the proxy domain, use the set-domain command again:
dvs img-proxy set-domain newdomain.com
The configuration is automatically reloaded after changing the domain. The change is applied immediately.
How It Worksβ
When the image proxy is enabled:
- Requests for images from the
/img/directory are intercepted - The request is forwarded to the remote domain you specified
- The image is fetched and served to your local site
- Subsequent requests may be cached locally
This allows you to:
- Work with production images without downloading them
- Test with real product images
- Reduce local storage requirements
Verifying the Configurationβ
After enabling, verify that images are being proxied:
- Check the status:
dvs img-proxy status - Visit your PrestaShop site and view product images
- Check the browser network tab to see if images are being loaded from the proxy
- Check proxy logs:
dvs logsto see proxy activity
Troubleshootingβ
Images Not Loadingβ
If images don't load after enabling the proxy:
- Verify the domain is correct:
dvs img-proxy status - Check that the remote domain is accessible
- Verify Apache configuration was reloaded
- Check application logs:
dvs logs
Domain Not Setβ
If you try to enable without setting a domain:
dvs img-proxy enable
# Error: domain not provided and not set
You must set the domain first:
dvs img-proxy set-domain example.com
dvs img-proxy enable
Configuration Not Appliedβ
If changes don't seem to apply:
- Check the status:
dvs img-proxy status - Force a browser refresh (Ctrl+Shift+R or Cmd+Shift+R) to clear cached images
- Try toggling:
dvs img-proxy toggle - Check Apache logs:
dvs logs - Restart the application:
dvs restart
Best Practicesβ
- Use image proxy only when needed (development/testing)
- Disable it when working with local images
- Set the domain to match your staging/production environment
- Test image loading after enabling the proxy
Next Stepsβ
- Learn how to create a PrestaShop site
- Learn how to access Mailpit
- Learn how to use phpMyAdmin