Instead of exposing the entire D2D web application via public IP (Option 3), we've implemented a secure API-based approach where:
- D2D API endpoints are protected with API key authentication
- VRG Hub builds its own UI and calls D2D's API
- D2D can stay on private network (10.200.1.8) - more secure
- No iframe/mixed content issues - clean HTTPS throughout
User Browser (HTTPS)
↓
VRG Hub (HTTPS) → iframe embedding → D2D UI (HTTP) ❌ Mixed content warning
↓
D2D Backend (Public IP required)
Problems:
- ❌ Mixed content warnings (HTTPS → HTTP)
- ❌ Entire D2D UI exposed to internet
- ❌ No authentication
- ❌ Security risks with PHI
User Browser (HTTPS)
↓
VRG Hub Frontend (React UI - HTTPS)
↓
VRG Hub Backend Proxy (adds API key)
↓ HTTP + X-API-Key header
D2D API (Private: 10.200.1.8:8000)
↓
PACS/Worklist
Benefits:
- ✅ No mixed content warnings
- ✅ D2D stays on private network
- ✅ API authentication (X-API-Key)
- ✅ VRG Hub controls UX
- ✅ Better security posture
All D2D API endpoints now require:
X-API-Key: your-api-key-hereConfigured via environment variable:
D2D_API_KEYS=key1,key2,key3Default for testing:
vrg-api-key-2026-secure-change-me
Production: Generate secure keys and set in environment
Protected (require API key):
- ✅ POST
/api/upload- File upload - ✅ POST
/api/convert- DICOM conversion - ✅ POST
/api/send- Send to PACS - ✅ POST
/api/worklist/query- Worklist query - ✅ POST
/api/worklist/test- Test worklist connection - ✅ GET
/api/destinations- Get destinations - ✅ POST
/api/destinations- Add destination - ✅ DELETE
/api/destinations/{name}- Delete destination - ✅ POST
/api/destinations/verify- Verify PACS connection - ✅ GET
/api/archives- List archives - ✅ GET
/api/archives/{filename}- Download archive - ✅ GET
/api/worklist/config- Get worklist config
Public (no authentication):
/- HTML UI (for direct access if needed)/worklist- Worklist HTML UI/diagnostics- Diagnostics page/static/*- Static files (CSS, JS)
File: /home/claudeagent/d2d/API-DOCUMENTATION.md
Contains:
- Complete API reference for all endpoints
- Request/response examples
- Authentication details
- Error handling
- Usage workflows
File: /home/claudeagent/vrg-hub/D2D-API-INTEGRATION-GUIDE.md
Contains:
- Step-by-step integration guide
- Backend proxy configuration (Vite, Next.js, Express)
- Frontend React component examples
- Complete workflow implementation
- Security best practices
- Deployment checklist
1. Set API Key (Production):
# On d2d-vm
ssh azureuser@10.200.1.8
cd /opt/d2d
# Generate secure API key
export D2D_API_KEYS="$(openssl rand -hex 32)"
# Add to docker-compose.yml or .env
echo "D2D_API_KEYS=${D2D_API_KEYS}" >> .env
# Restart D2D
sudo docker-compose down
sudo docker-compose up -d
# Share API key securely with VRG Hub team
echo $D2D_API_KEYS2. Keep D2D on Private Network:
# Remove public IP if previously added
az network nic ip-config update \
--resource-group VRG-PAX8 \
--nic-name d2d-vmVMNic \
--name ipconfigd2d-vm \
--remove publicIPAddress3. Monitor API Usage:
# Check logs for API calls
ssh azureuser@10.200.1.8
cd /opt/d2d
sudo docker-compose logs -f | grep "X-API-Key"1. Add D2D API proxy to VRG Hub backend
See: /home/claudeagent/vrg-hub/D2D-API-INTEGRATION-GUIDE.md
Quick Start (Vite):
// vite.config.ts
export default defineConfig({
server: {
proxy: {
'/api/d2d': {
target: 'http://10.200.1.8:8000',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api\/d2d/, '/api'),
configure: (proxy) => {
proxy.on('proxyReq', (proxyReq) => {
proxyReq.setHeader('X-API-Key', process.env.D2D_API_KEY || 'vrg-api-key-2026-secure-change-me');
});
},
},
},
},
});2. Build D2D UI in VRG Hub
See example component in integration guide.
3. Test the integration
// Test upload
const formData = new FormData();
formData.append('file', file);
const response = await fetch('/api/d2d/upload', {
method: 'POST',
body: formData
});
console.log(await response.json());
// Expected: { file_id: "...", filename: "...", size: ... }- ✅ API key authentication implemented
- ✅ All endpoints protected
- ✅ Documentation complete
- ✅ Committed to GitHub
- ⏳ Pending: Deploy to d2d-vm (auto-deployment will handle)
- Current: Public IP (4.198.108.152:8000) - can be removed
- Recommended: Keep on private IP (10.200.1.8:8000)
- API still works with authentication
- ✅ Integration guide complete
- ⏳ Pending: Implement backend proxy
- ⏳ Pending: Build D2D UI component
- ⏳ Pending: Deploy and test
If you previously implemented the iframe approach:
1. Remove public IP exposure (optional but recommended):
# If you want to keep D2D fully private
az network nic ip-config update \
--resource-group VRG-PAX8 \
--nic-name d2d-vmVMNic \
--name ipconfigd2d-vm \
--remove publicIPAddress2. Update VRG Hub:
- Remove iframe-based D2dConverter component
- Implement API proxy in backend
- Build new UI component using D2D API
- Test workflow: upload → convert → send
3. Deploy:
- Set D2D_API_KEY environment variable
- Deploy VRG Hub with new implementation
- Test from production URL
Auto-deployment is active!
Changes will auto-deploy within 15 minutes via the GitHub auto-deploy script.
Manual deployment:
ssh azureuser@10.200.1.8
cd /opt/d2d
git pull origin master
sudo docker-compose down
sudo docker-compose build
sudo docker-compose up -dVerify deployment:
# Test API without key (should fail with 401)
curl http://10.200.1.8:8000/api/destinations
# Test with API key (should succeed)
curl -H "X-API-Key: vrg-api-key-2026-secure-change-me" \
http://10.200.1.8:8000/api/destinationsFollow the integration guide to implement the API proxy and UI components.
-
Test API authentication on D2D:
- Wait for auto-deployment (~15 min)
- Test with curl
- Verify all endpoints require API key
-
Generate production API key:
- Use strong random key
- Store securely in D2D environment
- Share with VRG Hub team securely
-
VRG Hub implementation:
- Add backend proxy
- Build D2D UI component
- Test upload/convert/send workflow
- Test worklist query integration
-
Security review:
- Ensure API key in environment only
- Verify D2D on private network
- Test authentication enforcement
- Review access logs
-
Enhanced security:
- Rate limiting on API
- Enhanced logging and monitoring
- API key rotation procedure
- Alert on failed auth attempts
-
Documentation:
- VRG Hub user guide
- Admin procedures
- Troubleshooting guide
- API changelog
| Document | Location | Purpose |
|---|---|---|
| API Documentation | /home/claudeagent/d2d/API-DOCUMENTATION.md |
Complete API reference |
| VRG Hub Integration Guide | /home/claudeagent/vrg-hub/D2D-API-INTEGRATION-GUIDE.md |
Integration instructions |
| Public IP Deployment | /home/claudeagent/d2d/PUBLIC-IP-DEPLOYMENT.md |
Public IP approach (not recommended) |
| Worklist Feature | /home/claudeagent/d2d/WORKLIST-FEATURE.md |
Worklist functionality |
| VM Deployment | /home/claudeagent/d2d/VM-DEPLOYMENT-INFO.md |
D2D VM details |
| Aspect | iframe Approach | API Approach |
|---|---|---|
| Security | ❌ UI exposed | ✅ API only, with auth |
| Network | ❌ Needs public IP | ✅ Private network OK |
| HTTPS | ❌ Mixed content warning | ✅ HTTPS throughout |
| UX Control | ❌ Limited (iframe constraints) | ✅ Full control |
| Authentication | ❌ None or HTTP Basic | ✅ API key |
| Performance | ✅ Direct API calls | |
| Maintenance | ✅ Single UI in VRG Hub | |
| Mobile | ✅ Responsive design |
Winner: API Approach ✅
What we did:
- Added API key authentication to D2D
- Created comprehensive API documentation
- Created VRG Hub integration guide
- Committed everything to GitHub
What you get:
- Secure D2D API with authentication
- D2D can stay on private network
- VRG Hub can build custom UI
- No mixed content warnings
- Better security posture
What's next:
- Auto-deployment will update D2D (within 15 min)
- VRG Hub team implements API integration
- Test and deploy
Document Created: 2026-01-23 Last Updated: 2026-01-23 Status: ✅ Implementation Complete - Ready for VRG Hub Integration