Jay gajjar
Jay gajjar

Reputation: 151

Issue with GCP Load Balancer Configuration: /dev/ Prefix Handling

I'm configuring a GCP Load Balancer with route rules for different backend services based on URL prefixes. I want to match paths like /dev/two/, /dev/three/, etc., but all calls are hitting the default service when /dev/ is included in the path.

When I remove /dev/ from the prefix match (e.g., /two/), everything works fine, but I want to keep /dev/ in the route without it defaulting to the main backend.

Here’s my YAML configuration for the GCP Load Balancer:

defaultService: projects/my-project-101010/global/backendServices/one-back-end
name: matcher1
routeRules:
  - matchRules:
      - prefixMatch: /dev/two/
    priority: 1
    routeAction:
      weightedBackendServices:
        - backendService: projects/my-project-101010/global/backendServices/two-back-end
          weight: 100
  - matchRules:
      - prefixMatch: /dev/three/
    priority: 2
    routeAction:
      weightedBackendServices:
        - backendService: projects/my-project-101010/global/backendServices/three-back-end
          weight: 100
  - matchRules:
      - prefixMatch: /dev/four/
    priority: 3
    routeAction:
      weightedBackendServices:
        - backendService: projects/my-project-101010/global/backendServices/four-back-end
          weight: 100
  - matchRules:
      - prefixMatch: /dev/five
      - prefixMatch: /dev/six
      - prefixMatch: /dev/seven
      - prefixMatch: /dev/eight
    priority: 4
    routeAction:
      weightedBackendServices:
        - backendService: projects/my-project-101010/global/backendServices/five-to-eight-back-end
          weight: 100

What I'm trying to achieve:

What I have tried:

Has anyone encountered this issue or has suggestions on how to properly configure the routes with the /dev/ prefix while ensuring correct routing?

Upvotes: 0

Views: 19

Answers (0)

Related Questions