fix(socket): testing change to socket for reverse proxy

This commit is contained in:
2026-01-01 10:49:39 -05:00
parent d885f3aa11
commit c40da16d9e
4 changed files with 33 additions and 1 deletions
+4
View File
@@ -13,6 +13,10 @@
- Orphaned parts (parts no longer in Rebrickable's inventory) are now properly removed during refresh
- Refresh now works correctly for both set parts and minifigure parts
- Uses temporary tracking table to identify which parts are still valid before cleanup
- **Fixed Socket.IO connections behind reverse proxies**: Resolved WebSocket disconnection issues when using Traefik, Nginx, or other reverse proxies
- Root cause: Setting `BK_DOMAIN_NAME` enables strict CORS checking that fails with reverse proxies
- Solution: Leave `BK_DOMAIN_NAME` empty for reverse proxy deployments (allows all origins by default)
- Added debug logging for Socket.IO connections to help troubleshoot proxy issues
- **Fixed bulk import hanging on empty set numbers**: Resolved issue where trailing commas in bulk import input would cause infinite loops
- Empty strings from trailing commas (e.g., `"10312, 21348, "`) are now filtered out before processing
- Prevents "Set number cannot be empty" errors from blocking the bulk import queue
+4
View File
@@ -65,6 +65,8 @@ class BrickSocket(object):
)
# Inject CORS if a domain is defined
# Note: For reverse proxy deployments, leave BK_DOMAIN_NAME empty to allow all origins
# When empty, Socket.IO defaults to permissive CORS which works with reverse proxies
if app.config['DOMAIN_NAME'] != '':
kwargs['cors_allowed_origins'] = app.config['DOMAIN_NAME']
@@ -75,6 +77,8 @@ class BrickSocket(object):
**kwargs,
path=app.config['SOCKET_PATH'],
async_mode='gevent',
# Enable detailed logging in debug mode for troubleshooting
logger=app.config['DEBUG'],
# Ping/pong settings for mobile network resilience
ping_timeout=30, # Wait 30s for pong response before disconnecting
ping_interval=25, # Send ping every 25s to keep connection alive
+24
View File
@@ -0,0 +1,24 @@
services:
bricktracker:
container_name: BrickTracker
restart: unless-stopped
build: .
ports:
- "3334:3333"
volumes:
- ./local:/app/data # Data directory for database and files
- ./bricktracker:/app/bricktracker # Mount code for live reload
- ./templates:/app/templates # Mount templates for live reload
- ./static:/app/static # Mount static files for live reload
environment:
- BK_DEBUG=true
- FLASK_ENV=development
- FLASK_DEBUG=1
# For local development, place .env in data/ folder
# The app automatically detects and uses data/.env (no env_file needed)
# Uncomment below only if you keep .env in root for backward compatibility
# env_file: .env
develop:
watch:
- action: rebuild
path: requirements.txt
+1 -1
View File
@@ -74,7 +74,7 @@
## API and Network Configuration
| Variable | Purpose | Default | Required |
|----------|---------|----------|-----------|
| `BK_DOMAIN_NAME` | CORS origin restriction | None | No |
| `BK_DOMAIN_NAME` | Socket.IO CORS origin restriction (leave empty for reverse proxy) | None | No |
| `BK_REBRICKABLE_PAGE_SIZE` | Items per API call | `100` | No |
| `BK_SOCKET_NAMESPACE` | Socket.IO namespace | `bricksocket` | No |
| `BK_SOCKET_PATH` | Socket.IO path | `/bricksocket/` | No |