Skip to content

Commit

Permalink
fix: nginx config allows app page reload (#141)
Browse files Browse the repository at this point in the history
we have to redirect unknown url to index.html so that react app can handle them
  • Loading branch information
alexgarel authored Dec 2, 2022
1 parent b3fb054 commit ebc772b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion backend/editor/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
import os

uri = os.environ.get("NEO4J_URI", "bolt://localhost:7687")
access_token = os.environ.get("GITHUB_PAT", "<Add personal access token here>")
access_token = os.environ.get("GITHUB_PAT")
repo_uri = os.environ.get("REPO_URI", "openfoodfacts/openfoodfacts-server")
6 changes: 6 additions & 0 deletions conf/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ server {

index index.html;

location / {
# an unknown path is a path handled by react
try_files $uri $uri/ /index.html;
}


}


Expand Down
11 changes: 5 additions & 6 deletions docker/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,8 @@ services:
USER_UID: ${USER_UID:-1000}
USER_GID: ${USER_GID:-1000}
environment:
# disabling prod ui config and enabling node one
PROD_UI_SUFFIX: "-static"
DEV_UI_SUFFIX: ""
volumes:
# mount build folder dynamically
- ./taxonomy-editor-frontend/build:/opt/taxonomy-editor/build
# by default, disabling prod ui config and enabling node one
# you can change this settings to try the prod configuration,
# by setting PROD_UI_SUFFIX to "" and DEV_UI_SUFFIX to "-dev"
PROD_UI_SUFFIX: "${PROD_UI_SUFFIX--static}"
DEV_UI_SUFFIX: "${DEV_UI_SUFFIX-}"

0 comments on commit ebc772b

Please sign in to comment.