Files
Charon/frontend/src/testUtils/createMockProxyHost.ts
GitHub Actions 81085ec890 feat: add standard proxy headers with backward compatibility
Add X-Real-IP, X-Forwarded-Proto, X-Forwarded-Host, and X-Forwarded-Port headers to all proxy hosts for proper client IP detection, HTTPS enforcement, and logging.

- New feature flag: enable_standard_headers (default: true for new hosts, false for existing)
- UI: Checkbox in proxy host form and bulk apply modal for easy migration
- Security: Always configure trusted_proxies when headers enabled
- Backward compatible: Existing hosts preserve legacy behavior until explicitly enabled

BREAKING CHANGE: New proxy hosts will have standard headers enabled by default. Existing hosts maintain legacy behavior. Users can opt-in via UI.

Backend: 98.7% coverage, 8 new tests
Frontend: 87.7% coverage, full TypeScript support
Docs: Comprehensive migration guide and troubleshooting

Closes #<issue-number> (FileFlows WebSocket fix)
2025-12-19 20:32:03 +00:00

29 lines
715 B
TypeScript

import { ProxyHost } from '../api/proxyHosts'
export const createMockProxyHost = (overrides: Partial<ProxyHost> = {}): ProxyHost => ({
uuid: 'host-1',
name: 'Host',
domain_names: 'example.com',
forward_host: '127.0.0.1',
forward_port: 8080,
forward_scheme: 'http',
enabled: true,
ssl_forced: false,
websocket_support: false,
enable_standard_headers: true,
http2_support: false,
hsts_enabled: false,
hsts_subdomains: false,
block_exploits: false,
application: 'none',
locations: [],
certificate: null,
access_list_id: null,
certificate_id: null,
created_at: '2025-01-01T00:00:00Z',
updated_at: '2025-01-01T00:00:00Z',
...overrides,
})
export default createMockProxyHost