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 http://exampledomain.com/api would now go to… http://exampledomain.com/api on another server.

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

So all tracffic that would go to http://exampledomain.com/api would now go to… http://api.exampledomain.com/ on another server.

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

addEventListener('fetch', event => event.respondWith(fetch("https://newdomain.com/api"+(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 https://newdomain.com/api and not the target https://api.newdomain.com/api

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 “?”…

https://realintelligence.com/api/specific-holes-kml.py?orgId=00D300000009Z5G&propertyId=a2T3A000000sych&sandbox=False
v
I get he same error when just going to…
https://api.realintelligence.com/api/specific-holes-kml.py

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.