From aae1db265a99c8adda75a3252778b2c1bf1b5304 Mon Sep 17 00:00:00 2001 From: liquidrinu Date: Thu, 15 May 2025 18:00:24 +0200 Subject: [PATCH] fixed readme --- README.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/README.md b/README.md index 3b16a3b..b9bd10d 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,45 @@ The frontend will be available at http://localhost:3000 - Ensure all environment variables are properly set in your production environment - Never commit `.env` files to version control +## Frontend Routing in Production + +In production, the frontend is served through nginx. To ensure client-side routing works correctly: + +1. **Nginx Configuration** + - Ensure your nginx configuration includes the following directive to handle unknown routes: + ```nginx + location / { + try_files $uri $uri/ /index.html; + } + ``` + +2. **React Router Configuration** + - Set the `basename` dynamically based on the environment: + - In production, set `basename="/dashboard"`. + - In development, set `basename="/"`. + +3. **Navigation Links** + - Use relative paths in your navigation links (e.g., `to="canvas/canvas-endpoints"` instead of `to="/dashboard/canvas/canvas-endpoints"`). + +## HTTPS with Self-Signed Certificates + +To run the application with HTTPS using a self-signed certificate: + +1. **Generate a Self-Signed Certificate** + ```bash + openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout ./nginx/ssl/nginx.key -out ./nginx/ssl/nginx.crt + ``` + +2. **Update Docker Compose** + - Ensure your `docker-compose.yml` mounts the certificate files in the nginx service: + ```yaml + volumes: + - ./nginx/ssl:/etc/nginx/ssl + ``` + +3. **Nginx Configuration** + - Use the production nginx configuration that includes SSL settings. + ## Development Best Practices 1. **Database Management**