Reverse Proxy
Deploying Hoop Behind a Reverse Proxy
Hoop Gateway can be deployed behind a reverse proxy to enhance security, enable load balancing, and optimize production performance. This guide covers configuration steps for reverse proxy setups.
Architecture Overview
Hoop Gateway exposes two ports by default:
- Port 8009: Web interface and REST API (HTTP/1.1 and HTTP/2)
- Port 8010: gRPC service (HTTP/2)
When setting up a reverse proxy, both ports need to be properly configured to ensure all functionality works correctly.
Prerequisites
Before configuring your reverse proxy:
- Ensure your proxy server supports HTTP/2
- Configure TLS certificates
- Verify network connectivity between proxy and Hoop Gateway
- Understand your specific use case requirements (single domain vs multiple domains)
AWS Application Load Balancer
AWS Application Load Balancer (ALB) can route traffic to your Hoop Gateway instance with the following configuration:
-
Load Balancer Configuration:
- Enable HTTP/2 support
- Configure SSL/TLS certificates
-
Target Groups
Web/API Target Group:
- Port: 8009
- Protocol Version: HTTP1 or HTTP2
- Health Check:
- Protocol: HTTP
- Path:
GET /api/healthz
- Port: 8009
gRPC Target Group:
- Port: 8010
- Protocol Version: gRPC
- Health Check:
- Protocol: HTTP
- Path:
GET /
- Port: 8010
Nginx (Single Port Configuration)
This configuration demonstrates how to proxy both HTTP and gRPC protocols using a single port with Nginx:
Kubernetes Ingress Nginx
For Kubernetes deployments, you can use Ingress Nginx with separate domains for Web/API and gRPC services. This configuration performs TLS termination at the proxy level.
Troubleshooting
gRPC Logging
Enable detailed logging for HTTP/2 and gRPC connectivity by setting these environment variables:
Test connectivity using:
- Agent:
hoop start agent
- Client:
hoop connect myconnection
Common Issues
RST_STREAM error code INTERNAL_ERROR
If you encounter this error:
Check these common causes:
- VPN client configuration issues
- Incorrect gRPC protocol forwarding in reverse proxy
- HTTP/2 protocol not enabled in reverse proxy
HTTP/2 Frame Too Large
This error typically occurs in two scenarios:
-
TLS Mismatch
- Ensure clients use TLS when the gateway or proxy requires it
- Verify
HOOP_KEY
usesgrpcs://
orhttps://
scheme for agent connections - Check
grpc_url
in$HOME/.hoop/config.toml
usesgrpcs://
orhttps://
for client connections
-
HTTP/2 Protocol Issues
- Verify HTTP/2 is enabled in your reverse proxy
- Ensure proper protocol forwarding settings