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
Feat/base url config #836
base: main
Are you sure you want to change the base?
Feat/base url config #836
Conversation
…annot be fetched from the backend.
Thank you @liuyuanzhi-cn, this PR seems to be related to #335 |
react-router-dom supports adding basename, which will save a lot of files. by adjusting like this, there should be less code modifications.
However, by adding basename, no matter how you adjust it, there will be a certain degree of code intrusion, and a lot of testing is required, because it may also include some callback addresses returned by the API, or the oauth address in the plug-in, etc. Another way is to directly use nginx as a proxy without changing the code in the business. How effective is this method? |
I looked at the changes you submitted. There will be a lot of code intrusion and modification. I tried to achieve it by adding basename in combination with react-router-dom. This can be achieved with only a small amount of changes. You can refer to here. Of course, I only modified the front-end related routing configuration, and some routes returned through the API have not yet been adjusted. This modification should be reasonable. |
Indeed, this looks great, it's much more elegant this way, with a lot less code changes. |
We will confirm support for this requirement in subsequent versions as soon as possible! Of course, if you are interested, you are welcome to continue to submit PR according to this idea. |
Problem
I would love to use the second-level domain name of nginx to deploy
Answer
. However, this requires the webapp to work on relative url path (e.g. /foo/questions) or support setting a base url via configuration.Solution
Add support for setting a base/root url in the configuration or make the webapp work on relativ urls. Having this option is very useful in a variety of deployment scenarios (e.g. behind a reverse proxy).
Adds the config option
REACT_APP_BASE_URL_PATH
. When set to a value like/foo
, Anwser will be served fromhostname:port/foo
.Usage
ui/.env.production
file