I’ve created a Phoenix Umbrella project containing two applications. They will both be served as separate endpoints. To share assets between them, I’ve created a new application called “assets”, which sole purpose is to have the “/priv/static” directory. Now I would like to share the assets with both endpoints, and I already configured the static plug for that;
This works perfect in development. But when I build and start an release of one the endpoints, I run into the following error;
[error] Could not find static manifest at "/app/example_web/lib/example_web-0.1.0/priv/static/cache_manifest.json". Run "mix phx.digest" after building your static files or remove the configuration from "config/prod.exs".
How do I make my “example_web” endpoint aware of the cache manifest file in the “example_assets” directory? Thanks in advance for any help!
@LostKobrakai yeah I found about that as well so I’ve made the “example_assets” app an endpoint. But how do I route these assets requests from the “example_web” endpoint to the “example_assets” endpoint?
You don’t. You should only use one endpoint and not forward to another one. You could forward to different routers though. Imo the better option would be a PR to phoenix to enable the config of e.g. {:app, path} for : cache_static_manifest.
You’re correct, it is indeed not possible to forward any requests to another endpoint. I’ve created a PR in the Phoenix project to allow cache manifests from different apps (https://github.com/phoenixframework/phoenix/pull/3618).