Cloudflare Rules sign private S3 and GCS reads (27 Nov 2026): no Worker

Keep S3 and GCS buckets private, sign Cloudflare origin reads with a Transform Rule on Pro, and add visitor access control and caching yourself.

Read time
16 min
Word count
2.5K
Sections
10
FAQs
8
Share
Two engineers plan private bucket access beside a laptop and network switch, titled Signed Private Bucket Reads
On this page · 10 sections
  1. What Cloudflare shipped on 27 November
  2. Why this matters: the old workarounds
  3. Setting it up for a private S3 bucket
  4. Setting it up for a private Cloud Storage bucket
  5. What you still build yourself
  6. Plan limits and what it costs
  7. When R2 or a Worker is still the better fit
  8. India-specific considerations
  9. How eCorpIT can help
  10. References

Summary. On 27 November 2026 Cloudflare added HMAC signing, Signature Version 4 key derivation and UTC date formatting to its Rules language, so a Request Header Transform Rule can now authenticate reads from a private Amazon S3 or Google Cloud Storage bucket. The new sign_sigv4_hmac_sha256() function derives the signing key and returns the signature in one call; hmac_md5(), hmac_sha1(), hmac_sha256() and hmac_sha512() return raw digests; format_date() builds the date header and credential scope from the request timestamp. Paired with a Cloud Connector rule, this replaces the two usual workarounds: a public bucket limited to Cloudflare IP addresses, or a Worker that signs every request. The signing functions and sha256() need a Pro, Business or Enterprise plan; Pro costs $20 a month billed annually or $25 billed monthly, while format_date() works on every plan. The catch is scope. Cloudflare's worked example signs bodyless GET and HEAD requests for one object, and you still build the canonical request for every other path, query and header, control which visitors may trigger a signed read, and manage keys that sit in plain view in the rule.

About this article. This is for platform, DevOps and security engineers, and for SaaS and media teams in India, the US, the UK and elsewhere who serve files from S3 or Cloud Storage through Cloudflare. On 1 December 2026 we checked every function, limit, plan and price here against Cloudflare's changelog, its Rules, Cloud Connector, Snippets, cache and Workers documentation, its plans page, AWS's Signature Version 4 and S3 Block Public Access documentation, Google Cloud's HMAC key and signature documentation, and the European Central Bank's reference rates. Cloudflare changes plans and prices, so re-check before you commit; this is technical guidance, not legal or financial advice, and no vendor paid for inclusion. Researched with AI assistance and checked against the primary sources listed in the references.

What Cloudflare shipped on 27 November

The changelog entry adds HMAC functions, a SigV4 signer, format_date() and encode_hex() to the Rules language and names one target use: authenticating reads from private S3 and Cloud Storage buckets inside Request Header Transform Rules.

Function What it returns Plans
sign_sigv4_hmac_sha256() SigV4 signature as 64 lowercase hex characters Pro, Business, Enterprise
hmac_md5(), hmac_sha1(), hmac_sha256(), hmac_sha512() Raw keyed digest Pro, Business, Enterprise
sha256() Raw 32-byte hash Pro, Business, Enterprise
format_date() UTC date text from a Unix timestamp All plans
encode_hex() Lowercase hex text from raw bytes No plan note

The plan column comes from the changelog and the function reference; sha256() is not new in this entry, but the reference and the signing guide list it as Pro and above, and neither page attaches a plan to encode_hex().

The rule computes the date for you. A Transform Rule can set x-amz-date or x-goog-date from http.request.timestamp.sec and build the Authorization header from the same timestamp, so the caller never sends a date header. format_date() works only in URI, request header and response header rewrite expressions, not in rule filters. Cloudflare is explicit about the limit: you remain responsible for the canonical request and the string to sign.

How the signing function works

sign_sigv4_hmac_sha256() takes seven arguments, all required: the complete string to sign, the secret key, a Unix timestamp, the region, the service, a key prefix and a scope terminator. Starting from the prefix joined to the secret, it applies HMAC-SHA256 to the UTC date, region, service and terminator in turn, and the final derived key signs the input. That is the key derivation AWS describes for SigV4.

Provider Region argument Service Prefix Terminator
Amazon S3 Bucket region s3 AWS4 aws4_request
Google Cloud Storage auto storage GOOG4 goog4_request

These scope values are from Cloudflare's function reference. The function does not canonicalise the request, set headers, insert session tokens or assemble the Authorization header. It already returns hex text, so wrapping it in encode_hex() is a mistake Cloudflare warns against.

Per-expression limits that shape your rule

Three quotas apply inside a single header rewrite expression.

  • sign_sigv4_hmac_sha256() can appear once.
  • Each HMAC function can appear up to five times.
  • format_date() can appear up to four times, and the only field it accepts is http.request.timestamp.sec. Millisecond and computed timestamps are not supported.

Cloudflare's own S3 Authorization expression calls format_date() exactly four times: once for the credential date, twice inside the string to sign and once in the canonical headers. There is no headroom for another date-dependent value in that expression, which is one reason broader signing schemes may still need a Snippet or a Worker.

Why this matters: the old workarounds

Cloud Connector routes matching traffic to S3, Cloud Storage, Azure Blob Storage, Oracle Object Storage or R2, but it routes and does not authenticate. Its documentation still says that without separate origin authentication the bucket must be public, and suggests a provider policy that admits only Cloudflare IP addresses. That policy keeps casual visitors off the bucket URL, but the objects remain readable without credentials from any Cloudflare address.

The alternative was code. A Worker or a Snippet could sign each request. Workers run before the cache, so a Worker on the route is invoked on every request unless you turn on Workers Cache; even then, cache hits are still billed as Worker requests, though they use no CPU time. Snippets are lighter but are capped at 5 ms of execution time, 2 MB of memory and 32 KB of code, and are not available on the Free plan.

Signing in a Transform Rule removes both compromises for the simple case. S3 buckets can keep Block Public Access on (AWS says new buckets do not allow public access by default), and Cloud Storage buckets can keep public access prevention on.

Approach Bucket stays private Code to maintain Plan needed Main drawback
Public bucket with Cloudflare IP policy No None Any Objects readable without credentials
Worker that signs requests Yes Yes Workers Free or Paid Every request counts towards Workers billing
Snippet that signs requests Yes Yes, small Pro and up 5 ms execution and 32 KB code caps
Transform Rule with sign_sigv4_hmac_sha256() Yes Rule expression only Pro and up You build canonicalisation yourself

The table draws on Cloudflare's Cloud Connector provider notes, Snippets limits, Workers cache and pricing documentation and the new signing guide.

Setting it up for a private S3 bucket

Cloudflare's guide uses two rules on a proxied hostname such as storage.example.com, with SSL/TLS set to Full (strict). Cloud Connector sends the request to the bucket, and the Transform Rule signs it.

  1. Create a Cache Rule that bypasses cache for the hostname while you test, so a cached response cannot hide a signing failure.
  1. Create a Cloud Connector rule with Amazon S3 as the provider, the bucket URL in the form bucket.s3.region.amazonaws.com and a filter on the hostname. Use the HTTPS API endpoint, not a website endpoint, and avoid dots in the bucket name under Full (strict).
  1. Create a Request Header Transform Rule with a narrow filter: the hostname, GET or HEAD only, the exact path, an empty query string, no truncated header list, and no visitor-supplied x-amz, x-goog or Authorization headers.
  1. In that rule, set three headers: x-amz-date from format_date() with the pattern %Y%m%dT%H%M%SZ, x-amz-content-sha256 set to the static SHA-256 of an empty body, and Authorization from the signing expression.
  1. Test with plain curl requests that carry no credentials, confirm a direct unsigned request to the bucket fails, and confirm a wrong secret fails while caching is bypassed.

AWS requires the x-amz-content-sha256 header on S3 requests and the hash of an empty string when there is no payload; the signed headers must include host and every x-amz header. The Authorization value follows this shape in the Rules language:


            concat(
  "AWS4-HMAC-SHA256 Credential=<ACCESS_KEY_ID>/",
  format_date(http.request.timestamp.sec, "%Y%m%d"),
  "/<REGION>/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=",
  sign_sigv4_hmac_sha256(
    concat(
      "AWS4-HMAC-SHA256\x0a",
      format_date(http.request.timestamp.sec, "%Y%m%dT%H%M%SZ"), "\x0a",
      format_date(http.request.timestamp.sec, "%Y%m%d"), "/<REGION>/s3/aws4_request\x0a",
      encode_hex(sha256(concat(
        http.request.method, "\x0a", http.request.uri.path, "\x0a\x0a",
        "host:<BUCKET>.s3.<REGION>.amazonaws.com\x0a",
        "x-amz-content-sha256:<EMPTY_BODY_SHA256>\x0a",
        "x-amz-date:", format_date(http.request.timestamp.sec, "%Y%m%dT%H%M%SZ"), "\x0a\x0a",
        "host;x-amz-content-sha256;x-amz-date\x0a<EMPTY_BODY_SHA256>"
      )))
    ),
    "<SECRET_ACCESS_KEY>", http.request.timestamp.sec,
    "<REGION>", "s3", "AWS4", "aws4_request"
  )
)
          

Two details trip people up. First, the host in the canonical request is the bucket hostname, not storage.example.com, because the Transform Rule runs before Cloud Connector sets the Host header. Second, the date header and the signature each call format_date() on the request timestamp rather than reading the x-amz-date value the rule just set, because field values are immutable within a phase.

Temporary AWS credentials

With STS credentials you add an x-amz-security-token header, insert it into the canonical headers and append it to both signed-header lists. The rule holds the token as a static value and the signing function never obtains or refreshes credentials, so you must update the rule before the token expires. In practice that means automation that rewrites the rule through the API on every rotation, or a dedicated long-term key with read-only access to a narrow prefix.

Setting it up for a private Cloud Storage bucket

The Cloud Storage version uses the same two rules with the bucket URL bucket.storage.googleapis.com, x-goog-date and x-goog-content-sha256 headers, the GOOG4-HMAC-SHA256 algorithm and a credential scope of auto/storage/goog4_request. The key must be an HMAC key, not an RSA service account key, and the secret goes into the rule as text without Base64 decoding.

Google's own rules add constraints worth planning for.

  • HMAC keys work only with the Cloud Storage XML API, not the JSON API.
  • A service account can hold at most 10 HMAC keys; deleted keys do not count.
  • The secret is shown once at creation and cannot be retrieved later.
  • A new HMAC key can take up to 60 seconds to become usable.

For requests with signed headers, Google accepts a signature from 15 minutes before to 15 minutes after the active datetime in x-goog-date. Because the rule stamps each request with Cloudflare's own request timestamp, the visitor's device clock is never used.

Item Amazon S3 Google Cloud Storage
Algorithm AWS4-HMAC-SHA256 GOOG4-HMAC-SHA256
Date header x-amz-date x-goog-date
Payload hash header x-amz-content-sha256 x-goog-content-sha256
Credential scope date/region/s3/aws4_request date/auto/storage/goog4_request
Bucket hostname bucket.s3.region.amazonaws.com bucket.storage.googleapis.com
Credential type IAM access key HMAC key on a service account

The table summarises Cloudflare's signing guide and function reference.

What you still build yourself

The feature removes the signing code, not the design work. Cloudflare's guide lists the gaps plainly, and each one is a task for your team.

Canonicalisation for real traffic. The example matches one object, /test.txt, with no query string and no body, and does not cover general request canonicalisation, uploads or presigned URLs. AWS requires the canonical URI to be URI-encoded and query parameters to be encoded and sorted by name. Before you widen the filter to a prefix such as /assets/, test object keys with spaces, plus signs and non-ASCII characters, and keep refusing query strings unless you sign them. If you also rewrite URLs, confirm that the path you sign is the path the bucket receives; Cloudflare warns that later rules must not change the signed host, path or headers.

Visitor authorisation. Signing authenticates Cloudflare to the bucket, not the visitor to you. Anyone who matches the rule can trigger a signed read, and Cloudflare tells you to protect the hostname with your own access controls if objects must stay private. Cloudflare Access or a signed-token check are common choices; the function reference points to is_timed_hmac_valid_v0() for validating Cloudflare timed tokens.

Caching. Cloud Connector does not configure caching; you add Cache Rules for that. Cloudflare tells you to review caching and visitor authorisation together before allowing cache hits. Its Cache Everything guidance carries the same warning about visitors receiving content not meant for them.

Secrets. The access key and secret sit inside the rule expression, visible to anyone who can read the rule configuration. Transform Rules are open to users with the Firewall role or an Administrator role, so limit who holds those, give the key read access to only the objects it serves, and rotate it.

Monitoring and cost. Watch origin errors after every change. For S3, Cloudflare suggests server access logs, CloudTrail data events and CloudWatch metrics, and notes that storage requests, data transfer and logging can incur provider charges. Our breakdown of cloud egress fees across AWS, Azure, Google Cloud and R2 shows how much transfer charges can matter at volume.

Plan limits and what it costs

Signing needs Pro or above on the zone. Rule counts are the same for Transform Rules and Cloud Connector: 10 on Free, 25 on Pro, 50 on Business and 300 on Enterprise. One bucket needs one Cloud Connector rule and one Transform Rule, plus a Cache Rule.

Item Free Pro Business Enterprise
Signing, HMAC and sha256 functions No Yes Yes Yes
format_date Yes Yes Yes Yes
Active Transform Rules 10 25 50 300
Cloud Connector rules 10 25 50 300
Snippets 0 25 50 300

The table combines Cloudflare's changelog, Transform Rules, Cloud Connector and Snippets availability tables.

If you are on Free today, the comparison is with a Worker. Workers Free allows 100,000 requests a day; Workers Paid has a $5 monthly minimum per account that includes 10 million requests and 30 million CPU milliseconds, then $0.30 per additional million requests and $0.02 per additional million CPU milliseconds. Cloudflare's own worked example puts a Worker serving 15 million requests at 7 ms of CPU each at $8.00 a month: the $5 subscription, $1.50 for 5 million extra requests at $0.30 per million, and $1.50 for CPU time. Workers Cache does not remove the request charge, because cache hits are still billed as requests. A Transform Rule carries no per-request charge in Cloudflare's documentation, so the trade is a flat plan fee against request-based billing plus code you maintain. Our Workers vs Vercel Functions cost comparison goes deeper on Workers billing, and our note on Cloudflare spending limits covers caps for runaway Worker traffic.

Rupee and pound figures below use the ECB reference rates of 30 November 2026, crossed to ₹92.31 and £0.77 per US dollar and rounded to two decimals.

Option USD a month Rupees a month Pounds a month
Pro, billed annually 20.00 1,846.20 15.40
Pro, billed monthly 25.00 2,307.75 19.25
Workers Paid minimum 5.00 461.55 3.85
Workers Paid, Cloudflare's 15 million request example 8.00 738.48 6.16

Plan and Workers prices are from Cloudflare's plans and Workers pricing pages. The arithmetic for the last row: 8 times 92.31 is 738.48 rupees, and 8 times 0.77 is 6.16 pounds. Storage and transfer charges from AWS or Google are extra in every row.

When R2 or a Worker is still the better fit

If you control where the files live, R2 avoids origin signing for public content, though Cloud Connector requires an R2 bucket to be public on a custom domain in the same zone. Our piece on R2's US jurisdiction and its endpoint and token changes covers the trade-offs there.

A Worker or Snippet is still the right tool when you need per-user authorisation logic, uploads, presigned URL generation, query strings signed for many paths, or anything beyond the four format_date() calls and single signer an expression allows. For read-only delivery of private objects on a Pro zone, the Transform Rule is now the smaller and easier-to-audit option.

India-specific considerations

Indian teams often keep media, invoices or learning content in S3 or Cloud Storage buckets in Indian regions, behind Cloudflare for delivery. For S3 the region in the credential scope must be the bucket's own region; for Cloud Storage the scope uses auto. A signed origin does not by itself restrict who sees a file. If those buckets hold personal data covered by the Digital Personal Data Protection Act 2023, put visitor authorisation and short cache lifetimes in front of the hostname, and keep the rule's credentials limited to the objects that need delivery. This is not legal advice; check with your data protection lead.

How eCorpIT can help

eCorpIT is a Gurugram-based technology organisation, founded in 2021, assessed at CMMI Level 5 and MSME certified, with senior-led engineering teams working across AWS, Microsoft and Google platforms. Our cloud computing services team can set up Cloud Connector and signed Transform Rules for private S3 and Cloud Storage origins, with least-privilege keys, cache rules and visitor access control. Talk to us at /contact-us/.

Last updated: 1 December 2026.

References

  1. Sign storage requests with HMAC and automatic UTC dates, 27 November 2026 — Cloudflare changelog
  1. Functions — Cloudflare Ruleset Engine documentation
  1. Supported cloud providers in Cloud Connector — Cloudflare Rules documentation
  1. Sign requests to private S3 and GCS buckets — Cloudflare Rules documentation
  1. Plans and pricing — Cloudflare
  1. Create a signed AWS API request — AWS Identity and Access Management documentation
  1. Cloud Connector — Cloudflare Rules documentation
  1. How the cache works — Cloudflare Workers documentation
  1. Workers Cache — Cloudflare Workers documentation
  1. Snippets — Cloudflare Rules documentation
  1. Blocking public access to your Amazon S3 storage — Amazon S3 documentation
  1. Rules: field values during rule evaluation — Cloudflare Ruleset Engine documentation
  1. HMAC keys — Google Cloud Storage documentation
  1. Signatures — Google Cloud Storage documentation
  1. Cache Level (Cache Everything) — Cloudflare Cache documentation
  1. Transform Rules — Cloudflare Rules documentation
  1. Pricing — Cloudflare Workers documentation
  1. Euro foreign exchange reference rates, 30 November 2026 — European Central Bank

Frequently asked

Quick answers.

01 Can Cloudflare now serve files from a private S3 bucket without a Worker?
Yes. Since 27 November 2026 a Request Header Transform Rule can compute a Signature Version 4 Authorization header with the new signing function, and a Cloud Connector rule routes the request to the bucket. The bucket can keep Block Public Access on. Cloudflare's worked example covers bodyless GET and HEAD reads only.
02 Which Cloudflare plans can use the signing functions?
The HMAC functions, the SigV4 signer and sha256 are available on Pro, Business and Enterprise plans, so the Free plan cannot sign requests with Rules. The date formatting function works on every plan without an extra entitlement, but on its own it only formats dates and cannot authenticate a request.
03 Does this work with Google Cloud Storage as well as S3?
Yes. For Cloud Storage you use an HMAC key tied to a service account, the GOOG4-HMAC-SHA256 algorithm, the x-goog-date and x-goog-content-sha256 headers and the XML API hostname. Google limits each service account to ten HMAC keys and shows the secret only once, so store it safely.
04 Does signing the origin request stop the public from reading my files?
No. Signing proves Cloudflare's request to the bucket, not the visitor's right to the file. Anyone who matches the rule can trigger a signed read, and cached copies are served without going back to the bucket. Add your own visitor access control, such as Cloudflare Access or a token check, for private files.
05 Can I use temporary AWS credentials in the rule?
You can add the session token as a header and include it in the canonical request, but the rule stores it as a static value. Cloudflare's signing function does not fetch or refresh credentials, so you must update the rule before the token expires, usually through automation that calls the Cloudflare API.
06 How many signing calls can one rule expression contain?
One expression can call the SigV4 signer once, each HMAC function up to five times and the date formatting function up to four times. Cloudflare's S3 example already uses all four date calls, so more complex signing schemes may need a Snippet or a Worker instead of a single Transform Rule.
07 What does the Pro plan cost compared with a signing Worker?
Pro costs 20 dollars a month billed annually or 25 dollars billed monthly. Workers Paid starts at a 5 dollar monthly minimum with 10 million requests included, then 30 cents per extra million plus CPU charges. Every request to a Worker is billed, including cache hits, while a Transform Rule adds no per-request charge.
08 What parts of signing do I still have to build myself?
You build the canonical request for every path, query string and header you allow, URI-encode object keys correctly, stop later rules changing signed values, design caching and visitor access together, store and rotate keys, and monitor origin errors. Uploads and presigned URLs are outside Cloudflare's example and need separate work.

About the author

Manu Shukla

Founder & Director

Founder of eCorpIT. Hands-on engineer leading senior-only delivery for AI apps, custom software, and cloud systems for global clients.

Subscribe

One engineering note a week. No fluff, no spam.

Senior-architect playbooks on AI agents, mobile apps, cloud, security, data, and marketing — delivered every Wednesday.

Past the reading

Read enough. Let's build something.

A senior architect responds in 24 working hours with scope, indicative cost, and a timeline. NDA before any technical conversation.

Weekly engineering notes

Enjoying this article? Get one like it every Wednesday.

Senior-architect playbooks on AI agents, mobile apps, cloud, security, data and marketing. Unsubscribe in one click.

We email a link to confirm your address. Privacy

Loading search…

Browse all guides