mingc
September 13, 2024, 9:38pm
1
For Workes & Pages, what is the name of the domain?
NA
What is the error number?
HTTP/1.1 403 Forbidden
What is the error message?
403 Forbidden
403 Forbidden cloudflare
What is the issue or error you’re encountering
use worker as a proxy
What are the steps to reproduce the issue?
I would like to use workers as a proxy to process request. so my workers may get request like:
GET http://www.example.com/foo HTTP/1.1
CONNECT www.example.com:443 HTTP/1.1
Seems non of them was supported by workers. Got 500 server error or 403 Forbidden.
Is this a limitation of workers platform or do I missing anything?
Using a Worker as a proxy to another website is a common use-case and can work well.
Can you share your Worker code and the domain/service you’re trying to proxy perhaps? Some services do block Workers.
mingc
September 13, 2024, 10:32pm
3
Thanks for your reply @cherryjimbo .
It even not hit any worker code. deploy a simple work just console.log() not hit.
export default {
async fetch(request, env, ctx) {
const url = new URL(request.url);
console.log(`method=${request.method} url=${request.url}`);
Send request like:
curl -i --proxy https://<some-worker>.workers.dev http://www.example.com
1 Like
I’m not familiar with curl’s --proxy
option - does it transparently just pass-through HTTP requests like that?
What happens if you just load https://<some-worker>.workers.dev
in your browser? The worker code you shared above is incomplete, but I’m not sure if you just trimmed it.