How It Works
When you expose a TCP port, the gateway automatically wraps your traffic in TLS:- Client connects via TLS to
<app-id>-<port>.<cluster>.phala.network
- Gateway terminates TLS and decrypts the traffic
- Gateway forwards plain TCP to your service inside the CVM
- Your service doesn’t need to handle TLS - the gateway does it for you
Example: PostgreSQL Database
Example: Custom TCP Service
Connecting with TLS-to-TCP Conversion
Many existing clients don’t support connecting to TLS-wrapped TCP services. Use these methods to convert TLS back to plain TCP on your local machine:Port Forwarding Methods
Benefits
- Automatic encryption: No need to configure TLS in your service
- Zero-trust security: All external connections are encrypted
- Client compatibility: Use TLS-to-TCP conversion for legacy clients
- Simple deployment: Just expose the port, TLS is automatic
Internal vs External Access
Services can communicate internally without TLS:Troubleshooting
Connection refused?- Verify the port is exposed in docker-compose.yml
- Check the service is running: SSH in and run
docker ps
- Ensure you’re connecting to port 443 (not the service port)
- Use the correct hostname for TLS verification
- Install it:
apt install socat
(Ubuntu) orbrew install socat
(macOS) - Or use the Python script alternative
Next Steps
- Set up gRPC services
- Enable TLS passthrough for end-to-end encryption
- Configure custom domains