Page rule on status code

we could not use cloudflare proxy (only dns is possible) for the following reason:
target is cloudfront backed by s3 bucket with http status code redirection.
If i enable proxy, that redirection mechanism does not work. What i need is to move that redirection rule to cloudflare, but page rule does not show such option.

use cases:

  • resource does not exists with 301/307 double redirection: if object does not exist, forward to api gateway, create it and redirect back
  • 404 Fallback: we have public profile for each user (about 40 million), if user does not exist, redirect to a different domain. This also also done via 404 redirection on the s3 bucket.

Page Rules only apply to hostnames that are :orange: Proxied.

If you want a response-based rule, you’d have to write a Worker to do this.

Here’s some worker code that looks to alter behavior based upon response:

Thanks for your answer. Probably redirection will work using a worker, but intention of putting cloudflare proxy in front of cloudfront cdn is to reduce traffic costs. Cost of the worker will eat up most of the savings :frowning:

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