Fetch Media from Production or Staging Server
For local development and testing you do not have to copy all media files to your local environment.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/(media|thumbnail)/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ https://staging.example.com/$1 [L,R=301]
</IfModule> location @mediaserver {
resolver 1.1.1.1;
proxy_pass https://staging.example.com$request_uri;
proxy_set_header Authorization "Basic your-basic-auth-secret";
}
location ^~ /media/ {
access_log off;
expires max;
try_files $uri @mediaserver;
}
location ^~ /thumbnail/ {
access_log off;
expires max;
try_files $uri @mediaserver;
}Last updated