Skip to main content

Proxy Protocol

Gate supports the HAProxy PROXY protocol, which preserves the original client IP address when Gate is deployed behind load balancers, reverse proxies, or DDoS protection services.

What is PROXY Protocol?

The PROXY protocol is a network protocol designed to pass connection information (primarily the client’s IP address) through proxies and load balancers:
  • Developed by HAProxy
  • Industry-standard for preserving client information
  • Supports both TCP (v1) and binary (v2) formats
  • Works with load balancers, reverse proxies, and DDoS mitigation services
Without PROXY protocol, Gate would only see the load balancer’s IP address, not the actual player’s IP.

Why Use PROXY Protocol?

Problem: IP Address Masking

When Gate sits behind a load balancer:
Without PROXY protocol:
  • Gate sees all connections from 10.0.0.1 (load balancer IP)
  • Rate limiting breaks (all players share same IP)
  • IP bans don’t work properly
  • Geolocation services fail
  • Logs show wrong IP addresses
With PROXY protocol:
  • Gate receives the real player IP 203.0.113.50
  • Rate limiting works correctly per player
  • IP bans function properly
  • Accurate geolocation and logging

Configuration

Client-Side: Receiving PROXY Protocol

Configure Gate to receive PROXY protocol headers from upstream load balancers:
Enable when Gate is behind a load balancer:
Only enable proxyProtocol: true if your load balancer sends PROXY protocol headers. Enabling this without a PROXY protocol source will cause all connections to fail.

Backend-Side: Sending PROXY Protocol

Gate can also send PROXY protocol headers to backend servers:
Enable when backend servers expect PROXY protocol:
This is useful when backend servers are behind their own load balancers or need the original client IP.

Common Deployment Scenarios

Scenario 1: Gate Behind Load Balancer

Architecture:
Configuration: Load Balancer:
  • Enable PROXY protocol output
Gate (config.yml):
Backend Servers:
  • Configure Velocity forwarding (no PROXY protocol needed)

Scenario 2: DDoS Protection Service

Architecture:
Configuration: DDoS Protection Service:
  • Enable PROXY protocol in service settings
Gate (config.yml):
Many DDoS protection services (TCPShield, Cloudflare Spectrum, etc.) use PROXY protocol to preserve client IPs.

Scenario 3: Multi-Layer Proxy

Architecture:
Configuration: Gate (config.yml):
Backend Proxy:
  • Enable PROXY protocol receive
  • Forward to game servers using appropriate method

Scenario 4: Kubernetes/Docker

Architecture:
Configuration: Ingress/Service:
Gate (config.yml):

Gate Lite Mode

Gate Lite supports per-route PROXY protocol configuration:
Use case: Mixed backend requirements
This allows you to have some backends that support PROXY protocol and others that don’t.

Load Balancer Configuration

HAProxy

HAProxy configuration:
Gate configuration:

NGINX

NGINX TCP load balancing with PROXY protocol:
Gate configuration:

AWS Network Load Balancer

Enable PROXY protocol v2:
  1. Create target group for Gate instances
  2. Edit target group attributes:
    • Enable “Proxy protocol v2”
  3. Attach target group to load balancer
Gate configuration:
AWS NLB supports PROXY protocol v2. Application Load Balancers (ALB) do not support TCP passthrough.

Google Cloud Load Balancer

TCP Proxy Load Balancer with PROXY protocol:
Gate configuration:

DDoS Protection Services

TCPShield

TCPShield automatically uses PROXY protocol: Gate configuration:
Alternative: TCPShield RealIP Protocol Gate Lite supports TCPShield’s custom RealIP protocol:
TCPShield’s RealIP protocol is proprietary but supported in Gate Lite mode.

Cloudflare Spectrum

Cloudflare Spectrum supports PROXY protocol:
  1. Enable “Proxy Protocol” in Spectrum settings
  2. Configure Gate to receive PROXY protocol
Gate configuration:

OVH Game DDoS Protection

OVH supports PROXY protocol v2:
  1. Enable in OVH control panel
  2. Configure Gate accordingly
Gate configuration:

Security Considerations

PROXY Protocol Spoofing

NEVER enable proxyProtocol: true if Gate is directly exposed to the internet without a trusted load balancer.
If enabled without a trusted upstream proxy:
  • Attackers can send fake PROXY protocol headers
  • Spoof any IP address
  • Bypass IP bans and rate limiting
  • Forge connection source information

Firewall Protection

Always protect Gate with firewall rules:
Firewall rules ensure only your trusted load balancer can connect, preventing PROXY protocol spoofing attacks.

Docker/Kubernetes Network Policies

Kubernetes NetworkPolicy:

Troubleshooting

All Connections Fail After Enabling

Symptoms: No players can connect, timeout errors Cause: proxyProtocol: true but load balancer not sending PROXY headers Solutions:
  1. Verify load balancer is sending PROXY protocol
  2. Check load balancer configuration
  3. Disable if not behind a proxy:

All Players Show Same IP

Symptoms: All players have load balancer’s IP address Cause: PROXY protocol not enabled Solutions:
  1. Enable PROXY protocol on load balancer
  2. Enable in Gate:
  3. Verify firewall allows load balancer connections

Rate Limiting Not Working

Symptoms: Rate limiting applies to all players collectively Cause: All players share load balancer’s IP Solution: Enable PROXY protocol to see real IPs:

Invalid PROXY Protocol Header

Symptoms: Connection errors, “invalid PROXY protocol header” Causes:
  • Load balancer sending wrong PROXY protocol version
  • Firewall or middleware stripping headers
  • Direct player connections (when expecting PROXY protocol)
Solutions:
  1. Verify PROXY protocol version matches (v1 or v2)
  2. Check no middleware is interfering
  3. Ensure only load balancer can connect (firewall)

Testing PROXY Protocol

Manual Test

You can manually test PROXY protocol with telnet: PROXY protocol v1:
PROXY protocol v2:
Only test from authorized IPs when proxyProtocol: true is enabled.

Validation

Verify Gate sees correct IPs:
  1. Enable debug logging:
  2. Connect as player
  3. Check Gate logs for player’s real IP:
  4. Verify rate limiting works per-player

Best Practices

Production Deployment

Recommended configuration for production behind load balancer:
Firewall rules:

Development/Testing

Direct connection (no load balancer):
With local HAProxy testing: