plone / volto

React-based frontend for the Plone Content Management System
https://demo.plone.org/
MIT License
462 stars 626 forks source link

RAZZLE_PUBLIC_URL is overridden by server.jsx code #6119

Open ichim-david opened 4 months ago

ichim-david commented 4 months ago

Describe the bug Volto should use the razzle env for setting publicURL

To Reproduce Steps to reproduce the behavior: Start Volto with: RAZZLE_PUBLIC_URL=http://backend:8080/SITE pnpm start inspect within the browser devtools: window.env.publicURL locally you will see it being http://localhost:3000 instead of http://backend:8080/SITE

Expected behavior

  1. Remove https://github.com/plone/volto/blob/main/packages/volto/src/server.jsx#L162 Since we define config.settings.publicURL https://github.com/plone/volto/blob/main/packages/volto/src/config/index.js#L57

  2. use only config.settings.publicURL here https://github.com/plone/volto/blob/main/packages/volto/src/server.jsx#L293

davisagli commented 4 months ago

@ichim-david It makes sense to me that RAZZLE_PUBLIC_URL should take precedence if it was set. But let's not remove using res.locals.detectedHost -- that's important if RAZZLE_PUBLIC_URL was not set.