Implement robust firewall rules and network security policies to protect your OpenAI API Gateway from unauthorized access, DDoS attacks, and malicious traffic.
Restrict API access to known IP addresses and ranges only.
Prevent abuse by limiting requests per IP and per API key.
Web Application Firewall rules to block common attack patterns.
Public-facing layer where external requests first arrive. Minimal trust, maximum scrutiny.
API gateway and application servers. Authenticated access only.
Database and sensitive storage. Strictest access controls.
| Rule | Source | Destination | Port | Action |
|---|---|---|---|---|
| HTTPS Inbound | Any | API Gateway | 443 |
ALLOW |
| HTTP Redirect | Any | API Gateway | 80 |
ALLOW |
| SSH Admin | Admin IPs | Servers | 22 |
ALLOW |
| Database | App Servers | Database | 5432 |
ALLOW |
| Block All | Any | Any | * |
DENY |
Start with deny-all policy and explicitly allow only required traffic.
Grant minimum necessary permissions to each service and user.
Review firewall rules monthly and remove unused entries.
Enable comprehensive logging for security analysis and compliance.
Use infrastructure as code to manage and version firewall rules.
Implement rate limiting and use cloud DDoS protection services.