diff --git a/docs/k8s/user-guide.mdx b/docs/k8s/user-guide.mdx index 5adf05103..a6597bd43 100644 --- a/docs/k8s/user-guide.mdx +++ b/docs/k8s/user-guide.mdx @@ -582,7 +582,7 @@ spec: inbound: - name: "deny_patch" expressions: - - "req.Method == 'PATCH'" + - "req.method == 'PATCH'" actions: - type: "deny" --- diff --git a/examples/agent-config/tls-traffic-policy.mdx b/examples/agent-config/tls-traffic-policy.mdx index e884368dc..6d8d421b4 100644 --- a/examples/agent-config/tls-traffic-policy.mdx +++ b/examples/agent-config/tls-traffic-policy.mdx @@ -7,12 +7,12 @@ tunnels: on_tcp_connect: - name: EnforceTLS1.3 expressions: - - "conn.TLS.Version != 'TLS 1.3'" + - "conn.tls.version != '1.3'" actions: - type: deny - name: "LogRequestsFromKnownIP" expressions: - - "conn.ClientIP == '110.0.0.1'" + - "conn.client_ip == '110.0.0.1'" actions: - type: log config: diff --git a/examples/go-sdk/tcp-traffic-policy.mdx b/examples/go-sdk/tcp-traffic-policy.mdx index 01eb59a93..51fd556bc 100644 --- a/examples/go-sdk/tcp-traffic-policy.mdx +++ b/examples/go-sdk/tcp-traffic-policy.mdx @@ -33,7 +33,7 @@ Traffic Policies can be defined in `json` or `yaml`! "on_tcp_connect": [ { "name": "DenyTrafficOutsideUS", - "expressions": ["conn.Geo.CountryCode != 'US'"], + "expressions": ["conn.geo.country_code != 'US'"], "actions": [ { "type": "deny" @@ -42,7 +42,7 @@ Traffic Policies can be defined in `json` or `yaml`! }, { "name": "LogRequestsFromKnownIP", - "expressions": ["conn.ClientIP == '110.0.0.1"], + "expressions": ["conn.client_ip == '110.0.0.1"], "actions": [ { "type": "log", @@ -64,12 +64,12 @@ Traffic Policies can be defined in `json` or `yaml`! on_tcp_connect: - name: DenyTrafficOutsideUS expressions: - - conn.Geo.CountryCode != 'US' + - conn.geo.country_code != 'US' actions: - type: deny - name: LogRequestsFromKnownIP expressions: - - conn.ClientIP == '110.0.0.1 + - conn.client_ip == '110.0.0.1 actions: - type: log config: diff --git a/examples/go-sdk/tls-traffic-policy.mdx b/examples/go-sdk/tls-traffic-policy.mdx index df13c3aaa..0ac460b8c 100644 --- a/examples/go-sdk/tls-traffic-policy.mdx +++ b/examples/go-sdk/tls-traffic-policy.mdx @@ -33,7 +33,7 @@ Traffic Policies can be defined in `json` or `yaml`! "on_tcp_connect": [ { "name": "DenyTrafficOutsideUS", - "expressions": ["conn.Geo.CountryCode != 'US'"], + "expressions": ["conn.geo.country_code != 'US'"], "actions": [ { "type": "deny" @@ -42,7 +42,7 @@ Traffic Policies can be defined in `json` or `yaml`! }, { "name": "LogRequestsFromKnownIP", - "expressions": ["conn.ClientIP == '110.0.0.1"], + "expressions": ["conn.client_ip == '110.0.0.1"], "actions": [ { "type": "log", @@ -64,12 +64,12 @@ Traffic Policies can be defined in `json` or `yaml`! on_tcp_connect: - name: DenyTrafficOutsideUS expressions: - - conn.Geo.CountryCode != 'US' + - conn.geo.country_code != 'US' actions: - type: deny - name: LogRequestsFromKnownIP expressions: - - conn.ClientIP == '110.0.0.1 + - conn.client_ip == '110.0.0.1 actions: - type: log config: diff --git a/examples/javascript-sdk/tcp-traffic-policy.mdx b/examples/javascript-sdk/tcp-traffic-policy.mdx index a3310c3f6..a20ff6bc0 100644 --- a/examples/javascript-sdk/tcp-traffic-policy.mdx +++ b/examples/javascript-sdk/tcp-traffic-policy.mdx @@ -25,7 +25,7 @@ Traffic Policies can be defined in `json` or `yaml`! "on_tcp_connect": [ { "name": "DenyTrafficOutsideUS", - "expressions": ["conn.Geo.CountryCode != 'US'"], + "expressions": ["conn.geo.country_code != 'US'"], "actions": [ { "type": "deny" @@ -34,7 +34,7 @@ Traffic Policies can be defined in `json` or `yaml`! }, { "name": "LogRequestsFromKnownIP", - "expressions": ["conn.ClientIP == '110.0.0.1"], + "expressions": ["conn.client_ip == '110.0.0.1"], "actions": [ { "type": "log", @@ -56,12 +56,12 @@ Traffic Policies can be defined in `json` or `yaml`! on_tcp_connect: - name: DenyTrafficOutsideUS expressions: - - conn.Geo.CountryCode != 'US' + - conn.geo.country_code != 'US' actions: - type: deny - name: LogRequestsFromKnownIP expressions: - - conn.ClientIP == '110.0.0.1 + - conn.client_ip == '110.0.0.1 actions: - type: log config: diff --git a/examples/javascript-sdk/tls-traffic-policy.mdx b/examples/javascript-sdk/tls-traffic-policy.mdx index 8c5a10c6e..257a50e23 100644 --- a/examples/javascript-sdk/tls-traffic-policy.mdx +++ b/examples/javascript-sdk/tls-traffic-policy.mdx @@ -25,7 +25,7 @@ Traffic Policies can be defined in `json` or `yaml`! "on_tcp_connect": [ { "name": "DenyTrafficOutsideUS", - "expressions": ["conn.Geo.CountryCode != 'US'"], + "expressions": ["conn.geo.country_code != 'US'"], "actions": [ { "type": "deny" @@ -34,7 +34,7 @@ Traffic Policies can be defined in `json` or `yaml`! }, { "name": "LogRequestsFromKnownIP", - "expressions": ["conn.ClientIP == '110.0.0.1"], + "expressions": ["conn.client_ip == '110.0.0.1"], "actions": [ { "type": "log", @@ -56,12 +56,12 @@ Traffic Policies can be defined in `json` or `yaml`! on_tcp_connect: - name: DenyTrafficOutsideUS expressions: - - conn.Geo.CountryCode != 'US' + - conn.geo.country_code != 'US' actions: - type: deny - name: LogRequestsFromKnownIP expressions: - - conn.ClientIP == '110.0.0.1 + - conn.client_ip == '110.0.0.1 actions: - type: log config: diff --git a/examples/python-sdk/tcp-traffic-policy.mdx b/examples/python-sdk/tcp-traffic-policy.mdx index 472e7d7a7..379e1b8c7 100644 --- a/examples/python-sdk/tcp-traffic-policy.mdx +++ b/examples/python-sdk/tcp-traffic-policy.mdx @@ -15,7 +15,7 @@ Traffic Policies can be defined in `json` or `yaml`! "on_tcp_connect": [ { "name": "DenyTrafficOutsideUS", - "expressions": ["conn.Geo.CountryCode != 'US'"], + "expressions": ["conn.geo.country_code != 'US'"], "actions": [ { "type": "deny" @@ -24,7 +24,7 @@ Traffic Policies can be defined in `json` or `yaml`! }, { "name": "LogRequestsFromKnownIP", - "expressions": ["conn.ClientIP == '110.0.0.1"], + "expressions": ["conn.client_ip == '110.0.0.1"], "actions": [ { "type": "log", @@ -46,12 +46,12 @@ Traffic Policies can be defined in `json` or `yaml`! on_tcp_connect: - name: DenyTrafficOutsideUS expressions: - - conn.Geo.CountryCode != 'US' + - conn.geo.country_code != 'US' actions: - type: deny - name: LogRequestsFromKnownIP expressions: - - conn.ClientIP == '110.0.0.1 + - conn.client_ip == '110.0.0.1 actions: - type: log config: diff --git a/examples/python-sdk/tls-traffic-policy.mdx b/examples/python-sdk/tls-traffic-policy.mdx index 472e7d7a7..379e1b8c7 100644 --- a/examples/python-sdk/tls-traffic-policy.mdx +++ b/examples/python-sdk/tls-traffic-policy.mdx @@ -15,7 +15,7 @@ Traffic Policies can be defined in `json` or `yaml`! "on_tcp_connect": [ { "name": "DenyTrafficOutsideUS", - "expressions": ["conn.Geo.CountryCode != 'US'"], + "expressions": ["conn.geo.country_code != 'US'"], "actions": [ { "type": "deny" @@ -24,7 +24,7 @@ Traffic Policies can be defined in `json` or `yaml`! }, { "name": "LogRequestsFromKnownIP", - "expressions": ["conn.ClientIP == '110.0.0.1"], + "expressions": ["conn.client_ip == '110.0.0.1"], "actions": [ { "type": "log", @@ -46,12 +46,12 @@ Traffic Policies can be defined in `json` or `yaml`! on_tcp_connect: - name: DenyTrafficOutsideUS expressions: - - conn.Geo.CountryCode != 'US' + - conn.geo.country_code != 'US' actions: - type: deny - name: LogRequestsFromKnownIP expressions: - - conn.ClientIP == '110.0.0.1 + - conn.client_ip == '110.0.0.1 actions: - type: log config: diff --git a/traffic-policy/gallery.mdx b/traffic-policy/gallery.mdx index ebb8d6d75..11e5b7c1d 100644 --- a/traffic-policy/gallery.mdx +++ b/traffic-policy/gallery.mdx @@ -170,7 +170,7 @@ export const JWTsRateLimiting = () => ( algorithm: "sliding_window", capacity: 30, rate: "60s", - bucket_key: ["req.Headers['x-api-key']"], + bucket_key: ["req.headers['x-api-key']"], }, }, { @@ -225,7 +225,7 @@ export const RateLimitAuthentication = () => ( config={{ on_http_request: [ { - expressions: ["!('Authorization' in req.Headers)"], + expressions: ["!('Authorization' in req.headers)"], name: "Unauthorized rate limiting tier", actions: [ { @@ -235,13 +235,13 @@ export const RateLimitAuthentication = () => ( algorithm: "sliding_window", capacity: 10, rate: "60s", - bucket_key: ["conn.ClientIP"], + bucket_key: ["conn.client_ip"], }, }, ], }, { - expressions: ["('Authorization' in req.Headers)"], + expressions: ["('Authorization' in req.headers)"], name: "Authorized rate limiting tier", actions: [ { @@ -251,7 +251,7 @@ export const RateLimitAuthentication = () => ( algorithm: "sliding_window", capacity: 100, rate: "60s", - bucket_key: ["conn.ClientIP"], + bucket_key: ["conn.client_ip"], }, }, ], @@ -268,7 +268,7 @@ export const BlockCountries = () => ( on_http_request: [ { expressions: [ - "conn.Geo.CountryCode in ['', '']", + "conn.geo.country_code in ['', '']", ], name: "Block traffic from unwanted countries", actions: [ @@ -292,7 +292,7 @@ export const RateLimitPricing = () => ( config={{ on_http_request: [ { - expressions: ["!('Tier' in req.Headers)"], + expressions: ["!('Tier' in req.headers)"], name: "Free rate limiting tier", actions: [ { @@ -302,7 +302,7 @@ export const RateLimitPricing = () => ( algorithm: "sliding_window", capacity: 10, rate: "60s", - bucket_key: ["conn.ClientIP"], + bucket_key: ["conn.client_ip"], }, }, ], @@ -320,7 +320,7 @@ export const RateLimitPricing = () => ( algorithm: "sliding_window", capacity: 100, rate: "60s", - bucket_key: ["conn.ClientIP"], + bucket_key: ["conn.client_ip"], }, }, ], @@ -338,7 +338,7 @@ export const RateLimitPricing = () => ( algorithm: "sliding_window", capacity: 1000, rate: "60s", - bucket_key: ["conn.ClientIP"], + bucket_key: ["conn.client_ip"], }, }, ], @@ -356,7 +356,7 @@ export const RateLimitPricing = () => ( algorithm: "sliding_window", capacity: 10000, rate: "60s", - bucket_key: ["conn.ClientIP"], + bucket_key: ["conn.client_ip"], }, }, ], @@ -372,7 +372,7 @@ export const DeprecateVersion = () => ( config={{ on_http_request: [ { - expressions: ["'2' in req.Headers['X-Api-Version']"], + expressions: ["'2' in req.headers['X-Api-Version']"], name: "Deprecate API v2", actions: [ { @@ -443,14 +443,14 @@ export const EnforceTLS = () => ( config={{ on_http_request: [ { - expressions: ["req.ClientTLS.Version > '1.3'"], + expressions: ["conn.tls.version < '1.3'"], name: "Reject requests using old TLS versions", actions: [ { type: "custom-response", config: { status_code: 401, - content: "Unauthorized: bad TLS version", + content: "Unauthorized: TLS version too old", }, }, ], @@ -467,7 +467,7 @@ export const LogUnsuccessful = () => ( on_http_request: [], on_http_response: [ { - expressions: ["res.StatusCode < '200' && res.StatusCode >= '300'"], + expressions: ["res.status_code < '200' && res.status_code >= '300'"], name: "Log unsuccessful requests", actions: [ { @@ -493,8 +493,8 @@ export const LimitSize = () => ( on_http_request: [ { expressions: [ - "req.Method == 'POST' || req.Method == 'PUT'", - "req.ContentLength >= 1000", + "req.method == 'POST' || req.method == 'PUT'", + "req.content_length >= 1000", ], name: "Block POST/PUT requests of excessive length", actions: [