HTTP Fetch Request

Hi there whenever I try to make a fetch request to my HTTP website with my cloudfare worker, it returns error code: 521
7 Replies
Chaika
Chaika11mo ago
What are you trying to fetch, exactly? Workers have certain restrictions on outgoing fetches with non-standard ports for example
Mr. Goodman
Mr. GoodmanOP11mo ago
async getOrderQueue() {
return await(await fetch(
`http://us1.bot-hosting.net:20720/order_queue`,
{
method: "GET"
}
)).text();
}
async getOrderQueue() {
return await(await fetch(
`http://us1.bot-hosting.net:20720/order_queue`,
{
method: "GET"
}
)).text();
}
i have to use that port
Chaika
Chaika11mo ago
There's a nice flow chart here you can follow
No description
Mr. Goodman
Mr. GoodmanOP11mo ago
ok
Chaika
Chaika11mo ago
same-zone means same Cloudflare website, ex only a worker running on bot-hosting.net on a custom domain/route can fetch non-standard ports
Mr. Goodman
Mr. GoodmanOP11mo ago
so i cant request because of its port?
Chaika
Chaika11mo ago
yes, you workaround it by adding your own proxy in the middle that your worker calls, ex: Worker -> Your app on a standard port -> non-standard port request, using nginx or something else to proxy the requests also really shouldn't be using insecure http
Want results from more Discord servers?
Add your server