Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request to allow paths to be resolved relative to context root #283

Open
JiangLin369 opened this issue Jan 17, 2017 · 1 comment
Open

Request to allow paths to be resolved relative to context root #283

JiangLin369 opened this issue Jan 17, 2017 · 1 comment

Comments

@JiangLin369
Copy link

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.

@ahmedmdmohiuddin
Copy link

+1

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

No branches or pull requests

2 participants