why i get this error

im using cloudflare workers to point my subdomain to ip:port but if i opened the site through ip:port it works
7 Replies
Chaika
Chaika2y ago
What are you trying to do with Cloudflare Workers? You should probably be using Origin Rules, which can override the dest. port easily. Workers cannot fetch IPs, only domains
BeboQ
BeboQOP2y ago
and in my domain i add cname record "api" with content "xxxxxx.xxxxxx.workers.dev"
Chaika
Chaika2y ago
There are a few things wrong with that, request.url is the full url including the scheme/hostname, and "port" isn't valid, not sure if you redacted that, looks like something chatgpt would produce (just a guess, or did you get that from a modified example or something?). Configure SSL on your origin (can use origin ca cert CF gives for free), and then use a simple Origin Rule like this
BeboQ
BeboQOP2y ago
I added the Rule
Chaika
Chaika2y ago
You'll have to remove the worker route (they run in front of normal requests), and replace the API DNS Record with one pointing at your actual origin's IP (A/AAAA record), proxied
BeboQ
BeboQOP2y ago
@chaika.me THANKS SO MUCH I've been trying all day to do this
Chaika
Chaika2y ago
no problem MeowHeartCloudflare , you were making harder on yourself then it needed to be by using a worker
Want results from more Discord servers?
Add your server