Since the concept of web application context root is generally considered as a deployment concern as opposed to a development concern, I'd very much like to be able not to have to hardcode context root in the source code when using React Router for web page navigation, which would allow me to deploy my web application with any context root as specified by deployment descriptors, e.g. web.xml, without changing any of my React source code.
I understand that the "baseName" property can be used to specify the context root. And we could even try to set "baseName" to different values at the build time that would match the eventual context root specified by the deployment descriptors. However, I'd argue that doing so will only hide, not change, the fact the context root has to be embedded in the source code.
Since it’s more a norm than exception to treat the actual value of a context root as a deployment concern, I’d like to request a new feature that will allow React Router to resolve the path relative to the context root. For example, “/” will match “http//:myhost:port/webapp/”.
There’re different ways to accomplish this while providing the backward compatibility. One option is to add a new property, e.g.
Since the concept of web application context root is generally considered as a deployment concern as opposed to a development concern, I'd very much like to be able not to have to hardcode context root in the source code when using React Router for web page navigation, which would allow me to deploy my web application with any context root as specified by deployment descriptors, e.g. web.xml, without changing any of my React source code.
I understand that the "baseName" property can be used to specify the context root. And we could even try to set "baseName" to different values at the build time that would match the eventual context root specified by the deployment descriptors. However, I'd argue that doing so will only hide, not change, the fact the context root has to be embedded in the source code.
Since it’s more a norm than exception to treat the actual value of a context root as a deployment concern, I’d like to request a new feature that will allow React Router to resolve the path relative to the context root. For example, “/” will match “http//:myhost:port/webapp/”.
There’re different ways to accomplish this while providing the backward compatibility. One option is to add a new property, e.g.
<Route path="/" relativeToContextRoot="true" …>
Thanks very much for the consideration.