Skip to content

Commit

Permalink
feat(percentage): use actual percentage for cookie value (#6)
Browse files Browse the repository at this point in the history
Co-authored-by: Robert Schönthal <[email protected]>
  • Loading branch information
digitalkaoz and Robert Schönthal authored Jan 29, 2025
1 parent 744a4e5 commit bc5dd50
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@ jobs:
id: test-percentage-sticky-old-domain
continue-on-error: true
run: |
curl -Is localhost:80 --cookie "my_app=old_domain" | grep -i -e "server: Apache"
curl -Is localhost:80 --cookie "my_app=old_domain_50" | grep -i -e "server: Apache"
- name: Test Docker Image with Percentage Strategy with sticky cookie on new domain
id: test-percentage-sticky-new-domain
continue-on-error: true
run: |
curl -Is localhost:80 --cookie "my_app=new_domain" | grep -i -e "x-served-by: cache-"
curl -Is localhost:80 --cookie "my_app=new_domain_50" | grep -i -e "x-served-by: cache-"
- name: Test Docker Image with Percentage Strategy with round robin
id: test-percentage-round-robin
Expand Down
4 changes: 2 additions & 2 deletions haproxy.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ backend percentage_strategy
cookie "$COOKIE_PERCENTAGE_NAME" insert indirect

# old domain
server-template old_domain_percentage "$SERVER_COUNT" "$OLD_DOMAIN" cookie old_domain weight "$PERCENTAGE_OLD"
server-template old_domain_percentage "$SERVER_COUNT" "$OLD_DOMAIN" cookie "old_domain_$PERCENTAGE_OLD" weight "$PERCENTAGE_OLD"

# new domain
server-template new_domain_percentage "$SERVER_COUNT" "$NEW_DOMAIN" cookie new_domain weight "$PERCENTAGE_NEW"
server-template new_domain_percentage "$SERVER_COUNT" "$NEW_DOMAIN" cookie "new_domain_$PERCENTAGE_NEW" weight "$PERCENTAGE_NEW"

backend cookie_strategy
balance leastconn
Expand Down

0 comments on commit bc5dd50

Please sign in to comment.