Symptoms:
- Console shows "Access-Control-Allow-Origin" errors
- Web interface can't connect to CouchDB
- Failed to load resources from localhost:5984
Solution: Configure CORS in CouchDB (requires BOTH configuration sections):
Step 1: Enable CORS in [chttpd] section (CRITICAL - often missed!)
# This is the key setting that enables CORS processing
curl -X PUT "http://admin:password@localhost:5984/_node/_local/_config/chttpd/enable_cors" -d '"true"'Step 2: Configure CORS settings in [cors] section
# Enable CORS
curl -X PUT "http://admin:password@localhost:5984/_node/_local/_config/cors/enable" -d '"true"'
# Allow all origins (or specify your web server origin like "http://127.0.0.1:8080")
curl -X PUT "http://admin:password@localhost:5984/_node/_local/_config/cors/origins" -d '"*"'
# Enable credentials for authenticated requests
curl -X PUT "http://admin:password@localhost:5984/_node/_local/_config/cors/credentials" -d '"true"'
# Set allowed HTTP methods
curl -X PUT "http://admin:password@localhost:5984/_node/_local/_config/cors/methods" -d '"GET, PUT, POST, HEAD, DELETE"'
# Set allowed headers
curl -X PUT "http://admin:password@localhost:5984/_node/_local/_config/cors/headers" -d '"accept, authorization, content-type, origin, referer, x-csrf-token"'Step 3: Verify CORS is working
# Test that CORS headers are present in response
curl -I -H "Origin: http://127.0.0.1:8080" "http://localhost:5984/rules_db/_all_docs"
# Should show headers like:
# Access-Control-Allow-Origin: http://127.0.0.1:8080
# Access-Control-Allow-Credentials: trueImportant Notes:
- Both
chttpd/enable_cors = trueANDcors/enable = trueare required - Without
chttpd/enable_cors, the CORS headers won't be sent regardless of [cors] settings - For Docker containers, configuration may not persist across restarts unless volumes are used
Symptoms:
- Web interface loads but shows "Connecting to CouchDB..."
- Rules list doesn't populate
- No error messages in interface
Solution:
- Check CouchDB is running:
curl http://localhost:5984 - Verify database exists:
curl http://localhost:5984/rules_db - Check browser console for network errors
- Verify CORS configuration (see above)
Symptoms:
- 401 Unauthorized responses
- "Authentication required" errors
Solution:
Update credentials in web/js/utils/couchdb-client.js:
this.config = {
host: 'localhost',
port: 5984,
protocol: 'http',
username: 'admin', // Update with your admin username
password: 'password', // Update with your admin password
database: 'rules_db'
};Symptoms:
- Interface loads but no rules appear
- Empty rules list
Solution:
- Verify design documents exist:
curl "http://admin:password@localhost:5984/rules_db/_all_docs?startkey=\"_design/\"&endkey=\"_design0\"" - Check if validation rules are properly deployed
- Verify the database name matches in the client configuration
curl http://localhost:5984
# Expected: {"couchdb":"Welcome",...}curl http://admin:password@localhost:5984/rules_db
# Expected: Database info with doc_count, etc.curl "http://admin:password@localhost:5984/rules_db/_all_docs?startkey=\"_design/\"&endkey=\"_design0\""
# Expected: List of design documents- Start web server:
npm run serve:web - Open http://127.0.0.1:8080
- Check browser console for errors
- Verify rules load in the interface
- Problem: CORS headers not appearing in responses despite configuration
- Root Cause: Missing
chttpd/enable_cors = truesetting (most common issue) - Solution:
- Ensure both CORS configuration sections are set (see CORS section above)
- Restart CouchDB container:
docker restart couchdb-rules-engine - Verify with:
curl -I -H "Origin: http://127.0.0.1:8080" "http://localhost:5984/rules_db/_all_docs"
- Problem: CORS settings don't persist when Docker container restarts
- Solution: For Docker deployments, either:
- Recreate container with CORS environment variables
- Use Docker volumes to persist CouchDB configuration
- Run CORS configuration commands after each container restart
- Problem: Modal won't close, settings don't take effect
- Solution: Clear browser cache and localStorage:
localStorage.clear()in browser console
- Problem: "client.getInfo is not a function" or similar errors
- Root Cause: Incorrect method names in client calls
- Solution: Use correct CouchDB client methods:
client.testConnection()(notgetInfo())client.getDesignDocuments()(notgetAllDesignDocuments())
- Problem: Can't reach CouchDB from web interface
- Solution: Check if CouchDB is bound to correct interfaces, verify firewall settings
- Problem: Wrong credentials
- Solution: Update credentials in client configuration or check CouchDB admin setup