Skip to content

Pass font requests to PHP for Symfony Asset Mapper compatibility - #710

Merged
jaydrogers merged 2 commits into
serversideup:release/webserver-improvements-and-fixesfrom
ricardomm85:fix/fonts-php-fallback-asset-mapper
Oct 1, 2026
Merged

jaydrogers merged 2 commits into
serversideup:release/webserver-improvements-and-fixesfrom
ricardomm85:fix/fonts-php-fallback-asset-mapper

Conversation

@ricardomm85

Copy link
Copy Markdown
Contributor

👉 Describe the problem

#530 moved SVG out of the combined "svg, fonts" location block so Symfony Asset Mapper could serve versioned SVG files through PHP in development. The font filetypes that stayed behind in their own block still have no PHP fallback — unlike the "assets, media" and robots.txt blocks, a font request that doesn't exist on disk is answered by nginx with a 404 and never reaches PHP.

This breaks self-hosted fonts in development environments where the framework serves fonts virtually. With Symfony Asset Mapper (no asset-map:compile), every page requests fonts from /assets/fonts/*.woff2, nginx 404s each one, and pages render with fallback fonts even though the application is configured correctly.

👥 Problem evidence & reach

  • Symfony Asset Mapper dev environments: assets are virtual (nothing is written to public/assets/), so every font request 404s at nginx. Verified on serversideup/php:8.5-fpm-nginx-debian-v4.5.1: curl /assets/fonts/<versioned>.woff2 returns nginx's own 404 page while the same style of versioned .css/.js request passes through to PHP and returns 200 — the only difference is the missing fallback in the fonts block.
  • Production is unaffected by this change: when font files exist on disk, try_files $uri serves them directly, exactly as today; only requests nginx can't resolve fall through to index.php, which is how the media block already behaves.

🏆 How to solve this problem

Add the same try_files $uri /index.php?$query_string; line and comment that the "assets, media" block already has to the "fonts" block, keeping the Access-Control-Allow-Origin and cache headers untouched.

🥰 Describe the impact

@jaydrogers
jaydrogers changed the base branch from main to release/webserver-improvements-and-fixes October 1, 2026 16:43
@jaydrogers

Copy link
Copy Markdown
Member

Thank you! This will be shipped in this release:

@ricardomm85

Copy link
Copy Markdown
Contributor Author

Glad I could help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants