Require specific HTTP ports
By default, Cloudflare allows requests on a number of different HTTP ports.
You can target requests based on their HTTP port with the cf.edge.server_port
field. Use the in
comparison operator to target a set of ports.
This example blocks requests to www.example.com
that are not on ports 80
or 443
:
- Expression:
(http.host eq "www.example.com" and not cf.edge.server_port in {80 443})
- Action: Block
Was this helpful?
- Resources
- API
- New to Cloudflare?
- Products
- Sponsorships
- Open Source
- Support
- Help Center
- System Status
- Compliance
- GDPR
- Company
- cloudflare.com
- Our team
- Careers
- 2025 Cloudflare, Inc.
- Privacy Policy
- Terms of Use
- Report Security Issues
- Trademark