Created
          January 17, 2022 15:49 
        
      - 
      
 - 
        
Save vburlak/e285dedbb12371b38374513d04336ecf to your computer and use it in GitHub Desktop.  
    [DDEV-local] [Wordpress] extending NGINX to proxy missed image assets from production
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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