McSneaky
McSneaky
Explore posts from servers
CDCloudflare Developers
Created by McSneaky on 1/8/2024 in #workers-help
Modify request before calling other worker on specific URL
Is it possible to modify request before passing it to binding? Let's say I have code like this on top level worker that sits on https://example.com/edge/backporter
import { Router } from 'itty-router';
const router = Router();

router.get('/edge/backporter', async (request) => {
request.query = '?foobar' // modify request
// Set URL to specific URL in other worker
request.url = '/edge/v1' // Error, cannot set read-only property
return env.BINDING.fetch(request);
}
import { Router } from 'itty-router';
const router = Router();

router.get('/edge/backporter', async (request) => {
request.query = '?foobar' // modify request
// Set URL to specific URL in other worker
request.url = '/edge/v1' // Error, cannot set read-only property
return env.BINDING.fetch(request);
}
And on BINDING worker I have router that responds to certain URL only https://example.com/edge/v1
import { Router } from 'itty-router';
const router = Router();

router.get('/edge/v1', async (request) => { ... }
import { Router } from 'itty-router';
const router = Router();

router.get('/edge/v1', async (request) => { ... }
I'd like to make sure request from first worker ends up in /edge/v1, but it never does, since I can't change request URL, nor can I request.clone(), since then URL would match /edge/backporter and not /edge/v1 Is anything like this possible?
9 replies
CDCloudflare Developers
Created by McSneaky on 3/17/2023 in #pages-help
"That domain is already associated with an existing project" error, when it's not
4 replies
CDCloudflare Developers
Created by McSneaky on 2/2/2023 in #pages-help
Release Github repo from pages
Is there a way to release Github repo from page? We are moving domains and would like to release it from previous domain and point to new one without deleting whole old project Ofc workaround is to use Wrangler directly or direct upload, but Github repo would be more convenient
2 replies