Move SVG handling to media assets block for Symfony's Asset Mapper compatibility #530
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
👉 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?
/assets/images/logo-3c16d92m.svg
) should be correctly handled by the PHP applicationasset-map:compile
, SVG files should be served directly from the filesystem with proper caching