docker-php icon indicating copy to clipboard operation
docker-php copied to clipboard

Move SVG handling to media assets block for Symfony's Asset Mapper compatibility

Open ricardomm85 opened this issue 8 months ago • 0 comments

👉 Describe the problem

The current Nginx configuration separates SVG files from other media assets. This creates an inconsistency with how Symfony's Asset Mapper component handles assets, particularly in development environments where SVG files should be served through PHP just like other media assets.

👥 Problem evidence & reach

This affects all developers using Symfony's Asset Mapper with this Nginx configuration. The inconsistent handling causes problems in development environments where Asset Mapper needs to serve versioned SVG files through PHP, but the Nginx configuration doesn't forward these requests correctly.

🏆 How to solve this problem

Move the SVG file handling from the "svg, fonts" location block to the "assets, media" location block to align with Asset Mapper's handling of assets in both development and production environments.

🥰 Describe the "impact" on users?

This change will provide seamless integration with Symfony's Asset Mapper component. In development, SVG files will be properly served through the PHP application, allowing for dynamic versioning. In production (after running asset-map:compile), they'll be served directly by Nginx with appropriate caching headers. Developers will have a more consistent experience across environments and won't encounter issues specific to SVG files.

💯 How do we validate the problem is solved?

  • In development: Versioned SVG files (like /assets/images/logo-3c16d92m.svg) should be correctly handled by the PHP application
  • In production: After running asset-map:compile, SVG files should be served directly from the filesystem with proper caching
  • Confirm there are no 404 errors for SVG assets in either environment

ricardomm85 avatar Apr 20 '25 16:04 ricardomm85