I’m serving my React-built page with GCP using bucket. I just made a version2 page and want to go through a/b test. so i want to divide traffic into 50:50 who enters same domain.
so I tried do it in google cloud load balancer YAML editor
defaultService: projects/${projectName}/global/backendBuckets/${backEndBucket1Name}
name: matcher1
routeRules:
- matchRules:
- prefixMatch: /
priority: 1
routeAction:
weightedBackendServices:
- backendService: projects/${projectName}/global/backendBuckets/${backEndBucket1Name}
weight: 50
- backendService: projects/${projectName}/global/backendBuckets/${backEndBucket2Name}
weight: 50
and it keep fails. error logs says my url map resource is invalid.
I also tried updating lb itself by gcloud cli
with following urlmap.yaml
{
"defaultService": "projects/${projectName}/global/backendBuckets/${backEndBucket1Name}",
"fingerprint": "${myFingerPrint}",
"hostRules": [
{
"hosts": [
"${my-hosting-domain-name}"
],
"pathMatcher": "matcher1"
}
],
"name": "${my-lb-name}",
"pathMatchers": [
{
"defaultService": "https://www.googleapis.com/compute/v1/projects/${projectName}/global/backendBuckets/${backEndBucket1Name}",
"name": "matcher1",
"routeRules": [
{
"matchRules": [
{
"prefixMatch": "/"
}
],
"priority": 1,
"routeAction": {
"weightedBackendServices": [
{
"backendService": "https://www.googleapis.com/compute/v1/projects/${projectName}/global/backendBuckets/${backEndBucket1Name}",
"weight": 50
},
{
"backendService": "https://www.googleapis.com/compute/v1/projects/${projectName}/global/backendBuckets/${backEndBucket2Name}",
"weight": 50
}
]
}
}
]
}
]
}
i tried creating, editing existing one and all my tries failed. anyone can help me? T_T
I’m serving my React-built page with GCP using bucket. I just made a version2 page and want to go through a/b test. so i want to divide traffic into 50:50 who enters same domain.
2