Access the cf property over RPC instead of exclusively HTTP

For Workes & Pages, what is the name of the domain?

example.com

What is the issue or error you’re encountering

I am a big fan of Remote Procedural Calls that are available with Cloudflare workers. I have noticed, however, that certain things must still be done over HTTP even if they are worker to worker calls. For example performing an Image transformation with the cf.image property seems to only be possible to use through a subrequest to another worker or by using the /cdn-cgi/image pathway through a cloudflare pages. I want to be able to use a RPC to access this property instead of an http request. Is this possible?

What steps have you taken to resolve the issue?

I have tried using service bindings to forward HTTP requests as explained here.

What are the steps to reproduce the issue?

For my use-case I need to encrypt the urls used to access data out of an R2 bucket.
End-to-end I want to be able to accomplish the following:

  1. A user requests an image through an encrypted URL. (HTTP)
  2. The url is decrypted via a Cloudflare Worker.
  3. The unencrypted url is parsed and a reference is retrieved from a D1 database. (RPC)
  4. The reference is used to retrieve an image out of an R2 bucket. (RPC)
  5. The image is transformed with Cloudflare Image Transformations. (HTTP)
  6. The transformed image is returned back to the user.

So far, the only way I can work out to do this is with a maximum of 2 http requests. With caching, I can achieve one request but second requests may not be so common.

What I would like to achieve is one http Request to the Cloudflare ecosystem where everything is handled serverless and the resource is returned.

I haven’t found any way to do this.

Reference: Reference Architecture Diagram: Optimizing Image Delivery with Cloudflare Image Resizing and R2 · Cloudflare Reference Architecture docs

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.