Skip to content

Instantly share code, notes, and snippets.

@vburlak
Created January 17, 2022 15:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vburlak/e285dedbb12371b38374513d04336ecf to your computer and use it in GitHub Desktop.
Save vburlak/e285dedbb12371b38374513d04336ecf to your computer and use it in GitHub Desktop.
[DDEV-local] [Wordpress] extending NGINX to proxy missed image assets from production
server {
location ~* \.(png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
# Try to load missed assets from production.
proxy_intercept_errors on;
error_page 404 = @production;
}
# Rewrite assets location from dev env to production.
location @production {
rewrite ^/wp-content/uploads/(.*)$ https://www.example.com/wp-content/uploads/$1 break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment