Closed VictorGaiva closed 2 years ago
Can you share more about what you are doing and the kind of path_info the server is seeing? Thanks!
I have a React dev server using Vite listening on localhost:5000
. It rewrites /api/reports
to localhost:4002/api/reports
where Phoenix server is listening. I have prefixed my Endpoint
and routes with /api/reports
, and all assets and HTML load successfully.
But live_reload
is not able to load the /api/reports/phoenix/live_reload/frame
, giving 404
I've locally made a proof of concept that allows a :prefix
to be defined in the config the same way :suffix
is currently defined. This allowed me to make it work in my current setup. I'll be opening a PR so you can take a look
Diggin deeper I found this test which validates that the phoenix/live_reload/frame
URL is prefixed with the endpoint's path
, that happens correctly in my setup, but it doesn't check if it possible to correctly load the resource.
I have prefixed my Endpoint and routes with /api/reports, and all assets and HTML load successfully.
This is not the correct approach. :) Instead, you should have a plug in your endpoint that strips "/api/reports" from path info and automatically add it as the conn.script_name
. This way all routes work and are generated correctly without having to prefix your routes with /api/reports
When using a non default HTML Base URL, it is not possible to load
phoenix/live_reload/frame
since the path fragment here cannot be customized.