You can now configure Workers to run close to infrastructure in legacy cloud regions to minimize latency to existing services and databases. This is most useful when your Worker makes multiple round trips.
To set a placement hint, set the placement.region property in your Wrangler configuration file:
wrangler.jsonc
{
"placement":{
"region":"aws:us-east-1",
},
}
wrangler.toml
[placement]
region="aws:us-east-1"
Placement hints support Amazon Web Services (AWS), Google Cloud Platform (GCP), and Microsoft Azure region identifiers. Workers run in the Cloudflare data center with the lowest latency to the specified cloud region.
If your existing infrastructure is not in these cloud providers, expose it to placement probes with placement.host for layer 4 checks or placement.hostname for layer 7 checks. These probes are designed to locate single-homed infrastructure and are not suitable for anycasted or multicasted resources.
wrangler.jsonc
{
"placement":{
"host":"my_database_host.com:5432",
},
}
wrangler.toml
[placement]
host="my_database_host.com:5432"
wrangler.jsonc
{
"placement":{
"hostname":"my_api_server.com",
},
}
wrangler.toml
[placement]
hostname="my_api_server.com"
This is an extension of Smart Placement, which automatically places your Workers closer to back-end APIs based on measured latency. When you do not know the location of your back-end APIs or have multiple back-end APIs, set mode: "smart":
Cloudflare Rulesets now includes encode_base64() and sha256() functions, enabling you to generate signed request headers directly in rule expressions. These functions support common patterns like constructing a canonical string from request attributes, computing a SHA256 digest, and Base64-encoding the result.
New functions
Function
Description
Availability
encode_base64(input, flags)
Encodes a string to Base64 format. Optional flags parameter: u for URL-safe encoding, p for padding (adds = characters to make the output length a multiple of 4, as required by some systems). By default, output is standard Base64 without padding.
All plans (in header transform rules)
sha256(input)
Computes a SHA256 hash of the input string.
Requires enablement
Examples
Encode a string to Base64 format:
encode_base64("hello world")
Returns: aGVsbG8gd29ybGQ
Encode a string to Base64 format with padding:
encode_base64("hello world", "p")
Returns: aGVsbG8gd29ybGQ=
Perform a URL-safe Base64 encoding of a string:
encode_base64("hello world", "u")
Returns: aGVsbG8gd29ybGQ
Compute the SHA256 hash of a secret token:
sha256("my-token")
Returns a hash that your origin can validate to authenticate requests.
Compute the SHA256 hash of a string and encode the result to Base64 format:
encode_base64(sha256("my-token"))
Combines hashing and encoding for systems that expect Base64-encoded signatures.
You can now configure Workers to run close to infrastructure in legacy cloud regions to minimize latency to existing services and databases. This is most useful when your Worker makes multiple round trips.
To set a placement hint, set the placement.region property in your Wrangler configuration file:
wrangler.jsonc
{
"placement":{
"region":"aws:us-east-1",
},
}
wrangler.toml
[placement]
region="aws:us-east-1"
Placement hints support Amazon Web Services (AWS), Google Cloud Platform (GCP), and Microsoft Azure region identifiers. Workers run in the Cloudflare data center with the lowest latency to the specified cloud region.
If your existing infrastructure is not in these cloud providers, expose it to placement probes with placement.host for layer 4 checks or placement.hostname for layer 7 checks. These probes are designed to locate single-homed infrastructure and are not suitable for anycasted or multicasted resources.
wrangler.jsonc
{
"placement":{
"host":"my_database_host.com:5432",
},
}
wrangler.toml
[placement]
host="my_database_host.com:5432"
wrangler.jsonc
{
"placement":{
"hostname":"my_api_server.com",
},
}
wrangler.toml
[placement]
hostname="my_api_server.com"
This is an extension of Smart Placement, which automatically places your Workers closer to back-end APIs based on measured latency. When you do not know the location of your back-end APIs or have multiple back-end APIs, set mode: "smart":
Cloudflare Rulesets now includes encode_base64() and sha256() functions, enabling you to generate signed request headers directly in rule expressions. These functions support common patterns like constructing a canonical string from request attributes, computing a SHA256 digest, and Base64-encoding the result.
New functions
Function
Description
Availability
encode_base64(input, flags)
Encodes a string to Base64 format. Optional flags parameter: u for URL-safe encoding, p for padding (adds = characters to make the output length a multiple of 4, as required by some systems). By default, output is standard Base64 without padding.
All plans (in header transform rules)
sha256(input)
Computes a SHA256 hash of the input string.
Requires enablement
Examples
Encode a string to Base64 format:
encode_base64("hello world")
Returns: aGVsbG8gd29ybGQ
Encode a string to Base64 format with padding:
encode_base64("hello world", "p")
Returns: aGVsbG8gd29ybGQ=
Perform a URL-safe Base64 encoding of a string:
encode_base64("hello world", "u")
Returns: aGVsbG8gd29ybGQ
Compute the SHA256 hash of a secret token:
sha256("my-token")
Returns a hash that your origin can validate to authenticate requests.
Compute the SHA256 hash of a string and encode the result to Base64 format:
encode_base64(sha256("my-token"))
Combines hashing and encoding for systems that expect Base64-encoded signatures.
You can now configure Workers to run close to infrastructure in legacy cloud regions to minimize latency to existing services and databases. This is most useful when your Worker makes multiple round trips.
To set a placement hint, set the placement.region property in your Wrangler configuration file:
wrangler.jsonc
{
"placement":{
"region":"aws:us-east-1",
},
}
wrangler.toml
[placement]
region="aws:us-east-1"
Placement hints support Amazon Web Services (AWS), Google Cloud Platform (GCP), and Microsoft Azure region identifiers. Workers run in the Cloudflare data center with the lowest latency to the specified cloud region.
If your existing infrastructure is not in these cloud providers, expose it to placement probes with placement.host for layer 4 checks or placement.hostname for layer 7 checks. These probes are designed to locate single-homed infrastructure and are not suitable for anycasted or multicasted resources.
wrangler.jsonc
{
"placement":{
"host":"my_database_host.com:5432",
},
}
wrangler.toml
[placement]
host="my_database_host.com:5432"
wrangler.jsonc
{
"placement":{
"hostname":"my_api_server.com",
},
}
wrangler.toml
[placement]
hostname="my_api_server.com"
This is an extension of Smart Placement, which automatically places your Workers closer to back-end APIs based on measured latency. When you do not know the location of your back-end APIs or have multiple back-end APIs, set mode: "smart":
Cloudflare Rulesets now includes encode_base64() and sha256() functions, enabling you to generate signed request headers directly in rule expressions. These functions support common patterns like constructing a canonical string from request attributes, computing a SHA256 digest, and Base64-encoding the result.
New functions
Function
Description
Availability
encode_base64(input, flags)
Encodes a string to Base64 format. Optional flags parameter: u for URL-safe encoding, p for padding (adds = characters to make the output length a multiple of 4, as required by some systems). By default, output is standard Base64 without padding.
All plans (in header transform rules)
sha256(input)
Computes a SHA256 hash of the input string.
Requires enablement
Examples
Encode a string to Base64 format:
encode_base64("hello world")
Returns: aGVsbG8gd29ybGQ
Encode a string to Base64 format with padding:
encode_base64("hello world", "p")
Returns: aGVsbG8gd29ybGQ=
Perform a URL-safe Base64 encoding of a string:
encode_base64("hello world", "u")
Returns: aGVsbG8gd29ybGQ
Compute the SHA256 hash of a secret token:
sha256("my-token")
Returns a hash that your origin can validate to authenticate requests.
Compute the SHA256 hash of a string and encode the result to Base64 format:
encode_base64(sha256("my-token"))
Combines hashing and encoding for systems that expect Base64-encoded signatures.
You can now configure Workers to run close to infrastructure in legacy cloud regions to minimize latency to existing services and databases. This is most useful when your Worker makes multiple round trips.
To set a placement hint, set the placement.region property in your Wrangler configuration file:
wrangler.jsonc
{
"placement":{
"region":"aws:us-east-1",
},
}
wrangler.toml
[placement]
region="aws:us-east-1"
Placement hints support Amazon Web Services (AWS), Google Cloud Platform (GCP), and Microsoft Azure region identifiers. Workers run in the Cloudflare data center with the lowest latency to the specified cloud region.
If your existing infrastructure is not in these cloud providers, expose it to placement probes with placement.host for layer 4 checks or placement.hostname for layer 7 checks. These probes are designed to locate single-homed infrastructure and are not suitable for anycasted or multicasted resources.
wrangler.jsonc
{
"placement":{
"host":"my_database_host.com:5432",
},
}
wrangler.toml
[placement]
host="my_database_host.com:5432"
wrangler.jsonc
{
"placement":{
"hostname":"my_api_server.com",
},
}
wrangler.toml
[placement]
hostname="my_api_server.com"
This is an extension of Smart Placement, which automatically places your Workers closer to back-end APIs based on measured latency. When you do not know the location of your back-end APIs or have multiple back-end APIs, set mode: "smart":
Cloudflare Rulesets now includes encode_base64() and sha256() functions, enabling you to generate signed request headers directly in rule expressions. These functions support common patterns like constructing a canonical string from request attributes, computing a SHA256 digest, and Base64-encoding the result.
New functions
Function
Description
Availability
encode_base64(input, flags)
Encodes a string to Base64 format. Optional flags parameter: u for URL-safe encoding, p for padding (adds = characters to make the output length a multiple of 4, as required by some systems). By default, output is standard Base64 without padding.
All plans (in header transform rules)
sha256(input)
Computes a SHA256 hash of the input string.
Requires enablement
Examples
Encode a string to Base64 format:
encode_base64("hello world")
Returns: aGVsbG8gd29ybGQ
Encode a string to Base64 format with padding:
encode_base64("hello world", "p")
Returns: aGVsbG8gd29ybGQ=
Perform a URL-safe Base64 encoding of a string:
encode_base64("hello world", "u")
Returns: aGVsbG8gd29ybGQ
Compute the SHA256 hash of a secret token:
sha256("my-token")
Returns a hash that your origin can validate to authenticate requests.
Compute the SHA256 hash of a string and encode the result to Base64 format:
encode_base64(sha256("my-token"))
Combines hashing and encoding for systems that expect Base64-encoded signatures.
You can now configure Workers to run close to infrastructure in legacy cloud regions to minimize latency to existing services and databases. This is most useful when your Worker makes multiple round trips.
To set a placement hint, set the placement.region property in your Wrangler configuration file:
wrangler.jsonc
{
"placement":{
"region":"aws:us-east-1",
},
}
wrangler.toml
[placement]
region="aws:us-east-1"
Placement hints support Amazon Web Services (AWS), Google Cloud Platform (GCP), and Microsoft Azure region identifiers. Workers run in the Cloudflare data center with the lowest latency to the specified cloud region.
If your existing infrastructure is not in these cloud providers, expose it to placement probes with placement.host for layer 4 checks or placement.hostname for layer 7 checks. These probes are designed to locate single-homed infrastructure and are not suitable for anycasted or multicasted resources.
wrangler.jsonc
{
"placement":{
"host":"my_database_host.com:5432",
},
}
wrangler.toml
[placement]
host="my_database_host.com:5432"
wrangler.jsonc
{
"placement":{
"hostname":"my_api_server.com",
},
}
wrangler.toml
[placement]
hostname="my_api_server.com"
This is an extension of Smart Placement, which automatically places your Workers closer to back-end APIs based on measured latency. When you do not know the location of your back-end APIs or have multiple back-end APIs, set mode: "smart":