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

fix: if PUBLIC_URL setted, static resources cannot be fetched from the backend. #800

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

liuyuanzhi-cn
Copy link

@liuyuanzhi-cn liuyuanzhi-cn commented Feb 23, 2024

Bug Reproduction Steps

  1. Modify the PUBLIC_URL in the ui/.env.production file:
  TSC_COMPILE_ON_ERROR=true
  ESLINT_NO_DEV_ERRORS=true
  PUBLIC_URL = /forum
  REACT_APP_API_URL = /
  1. Recompile
  make ui
  make build
  1. Execute the initialization command:
INSTALL_PORT=9080 ./answer init -C ./answer-data/
  1. Access the initialization configuration page at http://localhost:9080/install and encounter the following error.

answer error page

Bug Resolution

During initialization and runtime, it is necessary to add the environment variable PUBLIC_URL.

# Initialization
INSTALL_PORT=9080 PUBLIC_URL=/forum ./answer init -C ./answer-data/
# Run
PUBLIC_URL=/forum ./answer run -C ./answer-data/

Note:

  1. If the value of PUBLIC_URL is the default /, there is no need to set the environment variable.
  2. The value of PUBLIC_URL must not end with /. For example, PUBLIC_URL=/forum is correct, while PUBLIC_URL=/forum/ is incorrect.

@liuyuanzhi-cn liuyuanzhi-cn changed the title [bugfix]-After setting PUBLIC_URL in the frontend, static resources c… [bugfix]-if PUBLIC_URL setted, static resources cannot be fetched from the backend. Feb 23, 2024
@liuyuanzhi-cn liuyuanzhi-cn changed the title [bugfix]-if PUBLIC_URL setted, static resources cannot be fetched from the backend. fix: if PUBLIC_URL setted, static resources cannot be fetched from the backend. Feb 23, 2024
@shuashuai shuashuai added this to the v1.3.0 milestone Feb 26, 2024
@LinkinStars LinkinStars self-assigned this Feb 27, 2024
@shuashuai shuashuai removed this from the v1.3.0 milestone Mar 22, 2024
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

Successfully merging this pull request may close these issues.

None yet

3 participants