Redirect or DNS Masking

So we have a domain that works fine but need to split between two servers.

So all tracffic that would go to would now go to… on another server.

is this possible? ro do we need to setup something like…

So all tracffic that would go to would now go to… on another server.

You can do that pretty easily with Workers, which would look something like this:

addEventListener('fetch', event => event.respondWith(fetch(""+(new URL(event.request.url)).pathname)));

Thanks for the suggestion. I have never used Workers yet. Will take a look

An alternative on Enterprise plans is to use the Resolve Override page rule, where you can change the Origin for certain requests based on a Page Rule path match.

Hi Unclear how to setup this up. You reference only and not the target

So I am getting and error. “You do not have access to that domain?”

The target would be specified in the Workers Route. When someone requests a URL that matches the Route, then the Worker triggers and pulls from newdomain/api

So here is what has been deployed…

Something strange is going on. If I request /api/, it says that /api/api/ can’t be found.

So I think it is partialy working. Getting a 500 server error now.

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

I think it is not passing the KVs after the “?”…
I get he same error when just going to…

How to handle that?

Hi… I fixed it so the not found has been resolved. It now gives an Internal Server error since all the vars are not being passed.

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