- Newest
- Most votes
- Most comments
It sounds like you're experiencing an issue with your Application Load Balancer (ALB) listener rules not working as expected. Based on your description, there are a few potential issues to investigate:
-
X-Forwarded-For Header Format: The X-Forwarded-For header typically contains a comma-separated list of IP addresses, not just a single IP. When you're using Cloudflare, this header will contain the client's IP followed by Cloudflare's IP. Your rule might be looking for an exact match of the entire header value, while you need to match just one IP in the list.
-
Header Matching Precision: Make sure the IP addresses in your rule exactly match what's coming in the X-Forwarded-For header. Even a single digit difference will cause the rule to fail.
-
Rule Evaluation Order: ALB evaluates rules in order of priority (lowest number first). Your rule with priority 100 should be evaluated before the rule with priority 110, which seems correct in your setup.
-
Cloudflare Interference: Since you're using Cloudflare, it might be modifying the headers. Try testing without Cloudflare to isolate the issue.
-
IP Set vs. Individual IPs: Instead of listing individual IPs in the rule condition, consider creating an IP set and referencing that in your rule. This can be more manageable and less error-prone.
-
Rule Condition Logic: Verify that your AND condition between the path and the header is set up correctly. The rule should only match when both conditions are true.
-
Testing Methodology: When testing, make sure you're using the exact path format
/tf_112/*that matches your rule.
If you've confirmed all these points and are still experiencing issues, you might want to temporarily simplify your rules to isolate the problem. For example, try creating a rule with just the path condition or just the IP condition to see which part might be causing the issue.
Sources
New Load Balancer Target Group Rule not working | AWS re:Post
No longer have http access to EC2 instance after elastic IP associated | AWS re:Post
answered a year ago
Relevant content
asked 22 days ago
- AWS OFFICIALUpdated 4 months ago
