I have deployed an AWS ALB Ingress Controller in EKS and k8s created an AWS ALB and created some rules to forward traffic:
As documentation says:
https://docs.aws.amazon.com//elasticloadbalancing/latest/application/load-balancer-listeners.html
Path Conditions
You can use path conditions to define rules that route requests based on the URL in the request (also known as path-based routing). The path pattern is applied only to the path of the URL, not to its query parameters. A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of the following characters.
A–Z, a–z, 0–9
_ - . $ / ~ " ' @ : +
& (using &)
*. (matches 0 or more characters)
? (matches exactly 1 character)
I have two rules:
1. IF Path is /api/* THEN Forward to XXX
2. IF Path is /* THEN Forward to YYY
URLs in my web app are:
1. example.com/api/users/1 Forward to XXX [200 - OK]
2. example.com/signin Forward to YYY [200 - OK]
3. example.com/login-user returns 404 (the hyphen is recognized as a pattern)
Expected: Rule that forward request 3 to YYY
I tried this:
IF Path is /* THEN Forward to YYY
No luck, in docs says nothing about, so how can I escape the hyphen to forward request 3 to YYY?
PD: I have around 50 uris with hyphens and I don't want rewrite them.
A bit of a hack, but try /login?user/*
in your rule.
The question mark should match the hyphen. Of course it will match any character, but that really should not affect your url resolution, unless you have some odd conflict in your URL paths eg /loginfuser or something.