Answer
Whistle supports proxying multiple protocols including HTTP, HTTPS, WebSocket, HTTP/2, etc., meeting debugging needs for different scenarios.
Supported Protocols
1. HTTP Protocol
Basic proxy:
shellwww.example.com host 127.0.0.1:8080
Forward proxy:
shellwww.example.com forward http://127.0.0.1:8080
Modify request:
shellwww.example.com reqHeaders://{custom-headers.json}
2. HTTPS Protocol
Basic proxy:
shellwww.example.com host 127.0.0.1:8443
Enable HTTPS interception:
shellpattern whistle.https://
Configure HTTPS certificate:
- Download root certificate
- Install to system
- Enable HTTPS interception
3. WebSocket Protocol
Basic proxy:
shellws://example.com host 127.0.0.1:8080 wss://example.com host 127.0.0.1:8080
Forward proxy:
shellws://example.com forward ws://127.0.0.1:8080 wss://example.com forward wss://127.0.0.1:8080
WebSocket message capture:
- Automatically capture connection establishment
- Record sent and received messages
- Display connection status
4. HTTP/2 Protocol
Whistle supports HTTP/2 protocol proxying:
- Automatic downgrade to HTTP/1.1
- Support for HTTP/2 multiplexing
- Support for server push
5. SOCKS Proxy
Configure SOCKS proxy:
shellwww.example.com socks://127.0.0.1:1080
SOCKS5 proxy:
shellwww.example.com socks5://127.0.0.1:1080
Protocol Conversion
1. HTTP to HTTPS
Configure rule:
shellhttp://www.example.com forward https://www.example.com
2. HTTPS to HTTP
Configure rule:
shellhttps://www.example.com forward http://www.example.com
3. WebSocket to HTTP
Configure rule:
shellws://example.com forward http://127.0.0.1:8080
Protocol-Specific Configuration
1. HTTP Protocol Configuration
Set request method:
shellwww.example.com method://POST
Set request headers:
shellwww.example.com reqHeaders://{http-headers.json}
Set response headers:
shellwww.example.com resHeaders://{http-headers.json}
2. HTTPS Protocol Configuration
Disable SSL verification:
shellwww.example.com disable://ssl
Set SSL version:
shellwww.example.com ssl://TLSv1.2
Custom CA certificate:
shellwww.example.com ca://{custom-ca.crt}
3. WebSocket Protocol Configuration
Set WebSocket subprotocol:
shellws://example.com protocol://chat
Set WebSocket timeout:
shellws://example.com timeout://30000
Set WebSocket heartbeat:
shellws://example.com ping://30000
Multi-Protocol Scenarios
1. Mixed Protocol Proxy
Proxy HTTP and HTTPS simultaneously:
shellwww.example.com host 127.0.0.1:8080 api.example.com host 127.0.0.1:8080
Proxy WebSocket and HTTP simultaneously:
shellws://example.com host 127.0.0.1:8080 www.example.com host 127.0.0.1:8080
2. Protocol Routing
Route by protocol:
shell# HTTP route to local http://www.example.com host 127.0.0.1:8080 # HTTPS route to test server https://www.example.com host test.example.com # WebSocket route to local ws://www.example.com host 127.0.0.1:8080
3. Protocol Conversion Scenarios
Development uses HTTP, production uses HTTPS:
shell# Development environment www.example.com forward http://127.0.0.1:3000 # Production environment www.example.com forward https://api.example.com
Protocol Debugging Tips
1. View Protocol Information
In whistle management interface:
- Click "Network" tab
- Click request to view details
- View protocol information in "General" tab
2. Protocol Downgrade Testing
Test HTTP/2 downgrade:
shellwww.example.com disable://h2
Test WebSocket downgrade:
shellws://example.com disable://websocket
3. Protocol Performance Testing
Test performance of different protocols:
shell# HTTP/1.1 www.example.com disable://h2 # HTTP/2 www.example.com enable://h2
Protocol Security
1. HTTPS Security
Enable HTTPS interception:
shellpattern whistle.https://
Verify certificate:
shellwww.example.com verify://ssl
Disable insecure protocols:
shellwww.example.com disable://ssl3 www.example.com disable://tls1
2. WebSocket Security
Use WSS:
shellwss://example.com host 127.0.0.1:8080
Verify WebSocket handshake:
shellws://example.com verify://websocket
Protocol Compatibility
1. Browser Compatibility
- Chrome/Edge: Full support for all protocols
- Firefox: Support for HTTP, HTTPS, WebSocket
- Safari: Support for HTTP, HTTPS, WebSocket
2. Server Compatibility
- Nginx: Support for HTTP, HTTPS, WebSocket
- Apache: Support for HTTP, HTTPS
- Node.js: Support for all protocols
3. Mobile Compatibility
- iOS: Support for HTTP, HTTPS, WebSocket
- Android: Support for HTTP, HTTPS, WebSocket
Protocol Best Practices
1. Development Environment
- Use HTTP protocol for easier debugging
- Use WebSocket for real-time communication
- Disable SSL verification for faster speed
2. Test Environment
- Use HTTPS to simulate production environment
- Use WSS to test secure connections
- Enable SSL verification to ensure security
3. Production Environment
- Use HTTPS to ensure security
- Use WSS to protect WebSocket
- Enable all security verifications
Protocol Troubleshooting
1. HTTPS Connection Failure
Check items:
- Is certificate correctly installed
- Do SSL versions match
- Is firewall blocking
Solution:
shellwww.example.com disable://ssl
2. WebSocket Connection Failure
Check items:
- Are proxy rules correct
- Does server support WebSocket
- Is network stable
Solution:
shellws://example.com forward ws://127.0.0.1:8080
3. Protocol Incompatibility
Check items:
- Client and server protocol versions
- Browser support
- Server configuration
Solution:
shellwww.example.com disable://h2