Skip to content

Commit cefe622

Browse files
feat(lb): add support for http_header_match (#1950)
Co-authored-by: Rémy Léone <[email protected]>
1 parent 8574ac0 commit cefe622

22 files changed

+3399
-1472
lines changed

cmd/scw/testdata/test-all-usage-lbacl-create-usage.golden

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ ARGS:
1010
name=<generated> Name of your ACL ressource
1111
[action.type] The action type (allow | deny)
1212
[match.ip-subnet.{index}] A list of IPs or CIDR v4/v6 addresses of the client of the session to match
13-
[match.http-filter] The HTTP filter to match (acl_http_filter_none | path_begin | path_end | regex)
13+
[match.http-filter] The HTTP filter to match (acl_http_filter_none | path_begin | path_end | regex | http_header_match)
1414
[match.http-filter-value.{index}] A list of possible values to match for the given HTTP filter
15+
[match.http-filter-option] A exra parameter. You can use this field with http_header_match acl type to set the header name to filter
1516
[match.invert] If set to `true`, the ACL matching condition will be of type "UNLESS"
1617
index Order between your Acls (ascending order, 0 is first acl executed)
1718
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | nl-ams-1 | pl-waw-1)

cmd/scw/testdata/test-all-usage-lbacl-update-usage.golden

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ ARGS:
1010
name Name of your ACL ressource
1111
[action.type] The action type (allow | deny)
1212
[match.ip-subnet.{index}] A list of IPs or CIDR v4/v6 addresses of the client of the session to match
13-
[match.http-filter] The HTTP filter to match (acl_http_filter_none | path_begin | path_end | regex)
13+
[match.http-filter] The HTTP filter to match (acl_http_filter_none | path_begin | path_end | regex | http_header_match)
1414
[match.http-filter-value.{index}] A list of possible values to match for the given HTTP filter
15+
[match.http-filter-option] A exra parameter. You can use this field with http_header_match acl type to set the header name to filter
1516
[match.invert] If set to `true`, the ACL matching condition will be of type "UNLESS"
1617
index Order between your Acls (ascending order, 0 is first acl executed)
1718
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | nl-ams-1 | pl-waw-1)

docs/commands/lb.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,9 @@ scw lb acl create [arg=value ...]
7373
| name | Required<br />Default: `<generated>` | Name of your ACL ressource |
7474
| action.type | One of: `allow`, `deny` | The action type |
7575
| match.ip-subnet.{index} | | A list of IPs or CIDR v4/v6 addresses of the client of the session to match |
76-
| match.http-filter | One of: `acl_http_filter_none`, `path_begin`, `path_end`, `regex` | The HTTP filter to match |
76+
| match.http-filter | One of: `acl_http_filter_none`, `path_begin`, `path_end`, `regex`, `http_header_match` | The HTTP filter to match |
7777
| match.http-filter-value.{index} | | A list of possible values to match for the given HTTP filter |
78+
| match.http-filter-option | | A exra parameter. You can use this field with http_header_match acl type to set the header name to filter |
7879
| match.invert | | If set to `true`, the ACL matching condition will be of type "UNLESS" |
7980
| index | Required | Order between your Acls (ascending order, 0 is first acl executed) |
8081
| zone | Default: `fr-par-1`<br />One of: `fr-par-1`, `nl-ams-1`, `pl-waw-1` | Zone to target. If none is passed will use default zone from the config |
@@ -162,8 +163,9 @@ scw lb acl update <acl-id ...> [arg=value ...]
162163
| name | Required | Name of your ACL ressource |
163164
| action.type | One of: `allow`, `deny` | The action type |
164165
| match.ip-subnet.{index} | | A list of IPs or CIDR v4/v6 addresses of the client of the session to match |
165-
| match.http-filter | One of: `acl_http_filter_none`, `path_begin`, `path_end`, `regex` | The HTTP filter to match |
166+
| match.http-filter | One of: `acl_http_filter_none`, `path_begin`, `path_end`, `regex`, `http_header_match` | The HTTP filter to match |
166167
| match.http-filter-value.{index} | | A list of possible values to match for the given HTTP filter |
168+
| match.http-filter-option | | A exra parameter. You can use this field with http_header_match acl type to set the header name to filter |
167169
| match.invert | | If set to `true`, the ACL matching condition will be of type "UNLESS" |
168170
| index | Required | Order between your Acls (ascending order, 0 is first acl executed) |
169171
| zone | Default: `fr-par-1`<br />One of: `fr-par-1`, `nl-ams-1`, `pl-waw-1` | Zone to target. If none is passed will use default zone from the config |

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ require (
1919
github.com/karrick/tparse v2.4.2+incompatible
2020
github.com/mattn/go-colorable v0.1.8
2121
github.com/mattn/go-isatty v0.0.13
22-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.7.0.20210510090404-0b46577f308f
22+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.7.0.20210707121459-c4899e298c98
2323
github.com/sergi/go-diff v1.1.0 // indirect
2424
github.com/spf13/cobra v1.2.1
2525
github.com/spf13/pflag v1.0.5

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,8 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L
238238
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
239239
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
240240
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
241-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.7.0.20210510090404-0b46577f308f h1:AkxRIEQ413mDXYlXFQ317j2JjIQaBIVhJbMgm4CRsL8=
242-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.7.0.20210510090404-0b46577f308f/go.mod h1:CJJ5VAbozOl0yEw7nHB9+7BXTJbIn6h7W+f6Gau5IP8=
241+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.7.0.20210707121459-c4899e298c98 h1:2VLw+nHp0U3R1VQApoDRUY45f+o4Knu9CMk/0hgSy+k=
242+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.7.0.20210707121459-c4899e298c98/go.mod h1:CJJ5VAbozOl0yEw7nHB9+7BXTJbIn6h7W+f6Gau5IP8=
243243
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
244244
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
245245
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=

0 commit comments

Comments
 (0)