Source policy of reverse proxy

Is it possible to create a source policy of reverse proxy - similar to policy routing.
I have two different services the old and the new one.
For some IPs I would like to display the new website and for other IPs only old one should be accessable.
Can Cloudflare realize that feature? How can I do that?
AS default CloudFlare use destination URL but in this case it should read source IP of clients to redirect traffic to proper service.

You could implement that using a Worker script, where you simply compare the client address to a list and then forward the request accordingly to its intended destination. Good old JavaScript code :slight_smile:

Hmmm OK. But it can slow down an access to the main/old service. Is it possible do it from CF panel?

I am not sure about your question. Can you rephrase that? A Worker script won’t slow down anything.

It is an answer. Thank you. If worker script do not slow down I am going to read about it and use this solution.

Essentially, you get the client IP address with request.headers.get('CF-Connecting-IP') and then you simply tweak the request URL you are passing to fetch(). That should do the trick.

@sandro Thank you I have noticed your solution to check it. Many thanks

This topic was automatically closed after 14 days. New replies are no longer allowed.