404 errors occur when multiple gateways configured with same TLS certificate
TOC
Problem Description
Symptom
When accessing services through Istio Ingress Gateway using HTTP/2 protocol, 404 errors occur. This is a known issue in the Istio community.
Root Cause
Configuring multiple gateways with the same TLS certificate causes HTTP/2 browsers to generate 404 errors when accessing secondary hosts after initial connection establishment. This occurs due to HTTP/2 connection reuse in browsers.
Example Scenario:
- Domains
a.example.comandb.example.comshare same TLS certificate - Configured in separate Gateway resources
- Browser accesses
a.example.comthenb.example.comvia same connection
Troubleshooting
Verification Script
Execute this script on the master node of the cluster hosting Istio Ingress Gateway:
Expected Output:
Solution for Root Cause 1: Merge Gateway Resources
Considerations
- This is the community-recommended solution
- Maintains HTTP/2 performance benefits
- Requires modification of existing Gateway configurations
Prerequisites
jqv1.7+ installed on cluster nodes- Access to cluster with kubectl privileges
Steps
- Identify conflicting Gateways using verification script
- Merge Host configurations:
- Update VirtualServices to reference merged Gateway
- Delete redundant Gateways
- Verify configuration:
Solution for Root Cause 2: 421 Response Code
Considerations
- Requires client support for 421 status code
- Compatible with Chrome/Firefox/Safari 15.1+
Prerequisites
- Istio version ≥ 1.12
- Cluster admin privileges
Steps
- Apply EnvoyFilter:
- Verify implementation:
Preventive Measures
- Certificate Management:
- Use wildcard certificates (*.example.com)
- Avoid certificate reuse across environments
- Gateway Design:
- Implement single gateway per domain pattern
- Use namespace-based certificate isolation
- Regular Audits:
Related Content
HTTP/2 Connection Reuse Mechanism:
- Single TLS connection handles multiple requests
- Server uses SNI to route requests
- Mismatched SNI headers cause routing failures
Istio Documentation Reference: Istio Common Problems - 404 Errors