@@ -111,11 +111,132 @@ For development, you can run services directly:
111111
112112### Nginx Proxy (Production Recommended)
113113For production deployment, nginx handles:
114- 1 . ** Wallet Service Proxying** : ` /wallet/* ` → ` localhost:9003 `
115- 2 . ** SSL Termination** : Single certificate for entire application
116- 3 . ** WebSocket Proxying** : Proper upgrade headers for relay WebSocket
117- 4 . ** Static Asset Caching** : Optimal performance for React app
118- 5 . ** Security Headers** : CORS, CSP, and other protections
114+ 1 . ** Relay WebSocket Proxying** : ` /relay ` and ` /relay/ ` → ` localhost:9001 ` (strips prefix)
115+ 2 . ** Wallet Service Proxying** : ` /wallet/* ` → ` localhost:9003 `
116+ 3 . ** SSL Termination** : Single certificate for entire application
117+ 4 . ** WebSocket Proxying** : Proper upgrade headers for relay WebSocket
118+ 5 . ** Static Asset Caching** : Optimal performance for React app
119+ 6 . ** Security Headers** : CORS, CSP, and other protections
120+
121+ #### Complete Working Nginx Configuration
122+ Here's a complete working nginx configuration for the HORNETS Relay Panel (tested on macOS and Linux):
123+
124+ ``` nginx
125+ # Define upstream servers for each service (using explicit IPv4 addresses)
126+ upstream transcribe_api {
127+ server 127.0.0.1:8000;
128+ }
129+
130+ upstream relay_service {
131+ server 127.0.0.1:9001;
132+ }
133+
134+ upstream panel_service {
135+ server 127.0.0.1:9002;
136+ }
137+
138+ upstream wallet_service {
139+ server 127.0.0.1:9003;
140+ }
141+
142+ # WebSocket connection upgrade mapping
143+ map $http_upgrade $connection_upgrade {
144+ default upgrade;
145+ '' close;
146+ }
147+
148+ # Main server block listening on HTTP
149+ server {
150+ listen 80; # Nginx listens on port 80 locally
151+ server_name _; # Accept all hostnames (localhost, ngrok, custom domains, etc.)
152+
153+ # Basic Security Headers
154+ add_header X-Frame-Options "SAMEORIGIN";
155+ add_header X-Content-Type-Options "nosniff";
156+ add_header X-XSS-Protection "1; mode=block";
157+ server_tokens off;
158+
159+ # Increase buffer sizes for large files
160+ client_max_body_size 100M;
161+
162+ # Forward client IP and protocol
163+ proxy_set_header X-Real-IP $remote_addr;
164+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
165+ proxy_set_header X-Forwarded-Proto $scheme;
166+ proxy_set_header Host $host;
167+
168+ # Health check endpoint - exact match first
169+ location = /health {
170+ access_log off;
171+ return 200 "healthy\n";
172+ add_header Content-Type text/plain;
173+ }
174+
175+ # Relay WebSocket service - handle both /relay and /relay/
176+ location ~ ^/relay/?$ {
177+ # Strip the /relay prefix (with or without trailing slash) when forwarding to the service
178+ rewrite ^/relay/?$ / break;
179+
180+ proxy_pass http://relay_service;
181+
182+ # WebSocket-specific headers
183+ proxy_http_version 1.1;
184+ proxy_set_header Upgrade $http_upgrade;
185+ proxy_set_header Connection $connection_upgrade;
186+ proxy_set_header Host $host;
187+ proxy_cache_bypass $http_upgrade;
188+
189+ # Extended timeouts for WebSocket connections
190+ proxy_read_timeout 86400s;
191+ proxy_send_timeout 86400s;
192+ proxy_connect_timeout 60s;
193+
194+ # Additional headers for tunnel compatibility
195+ proxy_set_header X-Forwarded-Proto $scheme;
196+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
197+ proxy_set_header X-Real-IP $remote_addr;
198+ }
199+
200+ # Transcribe service
201+ location /transcribe/ {
202+ rewrite ^/transcribe/(.*)$ /$1 break;
203+ proxy_pass http://transcribe_api;
204+ }
205+
206+ # Wallet service
207+ location /wallet/ {
208+ rewrite ^/wallet/(.*)$ /$1 break;
209+ proxy_pass http://wallet_service;
210+ }
211+
212+ # Default location - Panel service (frontend + API) - MUST BE LAST
213+ location / {
214+ proxy_pass http://panel_service;
215+ proxy_set_header Host $host;
216+ proxy_set_header X-Real-IP $remote_addr;
217+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
218+ proxy_set_header X-Forwarded-Proto $scheme;
219+
220+ # Handle WebSocket if needed
221+ proxy_http_version 1.1;
222+ proxy_set_header Upgrade $http_upgrade;
223+ proxy_set_header Connection $connection_upgrade;
224+ }
225+ }
226+ ```
227+
228+ ** Key Configuration Details:**
229+ - ** Relay WebSocket** : Uses regex matching ` ^/relay/?$ ` to handle both ` /relay ` and ` /relay/ ` paths
230+ - ** Rewrite Rule** : Strips the ` /relay ` prefix before forwarding to the relay service at port 9001
231+ - ** WebSocket Support** : Proper upgrade headers and extended timeouts for WebSocket connections
232+ - ** Service Routing** : Panel (root), wallet (` /wallet/ ` ), transcribe (` /transcribe/ ` ), and relay (` /relay ` )
233+ - ** Security** : Basic security headers and proper client IP forwarding
234+
235+ ** Deployment Steps:**
236+ 1 . Save this configuration to ` /etc/nginx/sites-available/hornets ` (or ` /opt/homebrew/etc/nginx/conf.d/hornets.conf ` on macOS)
237+ 2 . Enable the site: ` sudo ln -s /etc/nginx/sites-available/hornets /etc/nginx/sites-enabled/ `
238+ 3 . Test configuration: ` sudo nginx -t `
239+ 4 . Reload nginx: ` sudo nginx -s reload `
119240
120241## 📋 Prerequisites
121242
@@ -157,9 +278,7 @@ REACT_APP_ASSETS_BUCKET=http://localhost
157278REACT_APP_DEMO_MODE=false
158279REACT_APP_BASENAME=
159280
160- # Nostr relay configuration for profile fetching
161- REACT_APP_OWN_RELAY_URL=ws://localhost:9001
162- # REACT_APP_NOSTR_RELAY_URLS=wss://your-relay1.com,wss://your-relay2.com,wss://your-relay3.com
281+ # Nostr operations now use panel API - no relay URLs needed
163282
164283# More info https://create-react-app.dev/docs/advanced-configuration
165284ESLINT_NO_DEV_ERRORS=true
@@ -176,15 +295,13 @@ Create `.env.production` for production builds:
176295REACT_APP_DEMO_MODE=false
177296
178297# Service URLs
179- REACT_APP_WALLET_BASE_URL=http://localhost:9003 # Optional - leave empty to disable wallet features
180- REACT_APP_OWN_RELAY_URL=ws://localhost:9001 # Required for profile fetching
298+ # REACT_APP_WALLET_BASE_URL - No longer needed! Wallet operations routed through panel API
181299
182300# Router configuration (empty for direct access)
183301REACT_APP_BASENAME=
184302PUBLIC_URL=
185303
186- # Optional: Custom Nostr relay URLs (comma-separated list)
187- # REACT_APP_NOSTR_RELAY_URLS=wss://your-relay1.com,wss://your-relay2.com
304+ # Nostr operations now use panel API - no relay URLs needed
188305
189306# Development optimizations
190307ESLINT_NO_DEV_ERRORS=true
@@ -193,10 +310,9 @@ TSC_COMPILE_ON_ERROR=true
193310
194311
195312** 🎯 Key Requirements** :
196- - ✅ ** Relay URL Required** - REACT_APP_OWN_RELAY_URL must be configured for profile fetching
197- - ✅ ** Wallet URL Optional** - REACT_APP_WALLET_BASE_URL can be empty to disable wallet features
313+ - ✅ ** Wallet Always Available** - Wallet operations routed through panel API, no configuration needed
198314- ✅ ** Panel Routing Auto-Detection** - Panel paths (REACT_APP_BASENAME/PUBLIC_URL) can be auto-detected
199- - ✅ ** Build-Time Configuration** - Service URLs are baked into the JavaScript bundle during build
315+ - ✅ ** Simplified Configuration** - Uses default Nostr relay URLs, no custom configuration needed
200316- ✅ ** Simple Deployment** - No reverse proxy needed for basic functionality
201317
202318### 4. Start Development Server
@@ -264,16 +380,13 @@ Controls the React app's routing base path:
264380
265381### Service URLs
266382** 🎯 Configuration Requirements** :
267- - ** Wallet Service** : ` REACT_APP_WALLET_BASE_URL=http://localhost:9003 ` (optional - leave empty to disable wallet features)
268- - ** Relay WebSocket** : ` REACT_APP_OWN_RELAY_URL=ws://localhost:9001 ` (required for profile fetching)
383+ - ** Wallet Service** : No longer requires configuration! Wallet operations are routed through panel API (` /api/wallet-proxy/* ` )
269384- ** Panel API** : Auto-detected from current origin (no configuration needed)
270385
271- ** Note ** : When wallet URL is not configured, send/receive buttons will show a helpful message about rebuilding with wallet configuration .
386+ ** ✅ Simplified ** : Wallet functionality is now always available through the panel's backend proxy .
272387
273388** Manual Override** (development only):
274389- ** REACT_APP_BASE_URL** : Panel API endpoint (dev mode only)
275- - ** REACT_APP_WALLET_BASE_URL** : Wallet service endpoint (dev mode only)
276- - ** REACT_APP_NOSTR_RELAY_URLS** : Additional Nostr relays (optional)
277390
278391### Demo Mode
279392Set ` REACT_APP_DEMO_MODE=true ` to enable demo functionality with mock data.
0 commit comments