Add page rules to support POST API requests

Hi,

My web app built in no-code platform (bubble.io) and I set my domain (makesapp.co) for this web app.
I also have another server that includes API calls, and runs on AW. I want to connect the server to this domain too (something like api.makesapp.co).
I tried to use page rules to forward url from this url ‘api.makesapp.co’ to the AWS real url.
When i’m trying to call some API requests, it works good for GET requests, but doens’t succeed on POST requests.
I would like to know how can I make it works also on POST and other API requests.

Thanks in advance.

Browsers will not follow the same HTTP method in the next request if they receive HTTP 301 or 302 redirects from your API, this means that next request will be made using GET method no matter which method you used initially. HTTP 307 or 308 are the correct response code to instruct browsers to use the same HTTP method in the next request - but page rules only support 301 and 302.

Anyway, I’m curious why you want to use redirection other than domain masking? Using redirection means +1 request to make by the browser (one to api.makesapp.co, one to AWS endpoint).

I don’t know another way to do this. How can I do ‘domain masking’ ? I thought maybe to set it as a CNAME / A record but not sure if it’s gonna work.

You can use Cloudflare Workers to achieve this, but depends on your traffic size - you might need to pay some money to run the Workers script:

Use this as your reference:

https://developers.cloudflare.com/workers/tutorials/configure-your-cdn

Thanks for your help !

1 Like

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