Creade redirection for subdomain

Hello,

I have two sites that go through Cloudflare: site1.domain.com, a React-based app hosted in Cloudflare Pages and site2.domain.com, which serves as an API for the React app and it’s hosted elsewhere (AWS).

Everything works fine, but I would like to move site2.domain.com to site1.domain.com/api to avoid having CORS issues. Is this a thing that can be accomplished with Cloudflare?

Thanks.

I think thats the same request as here: Forward subfolder requests to different server using Page Rules? - #2 by tobezuk

Where you want to have it configuired like this:

  1. site1.domain.com/* (nothing to be done)
  2. site1.domain.com/api* ==> site2.domain.com

Like mentioned in the linked answer, this seems to be an enterprise solution. But more down in the thread he mentioned, it also is possible to achive the same with Cloudflare Workers: Forward subfolder requests to different server using Page Rules? - #4 by tobezuk

Hope this helps you.

1 Like