cloudflare workers custom recipe


I have cloudflare worker recipe for redirecting visitor from some country to another subdomain ,

i need to redirect the visitors with keeping on requested link like if the user request url like [login to view URL]

to be like

[login to view URL]

my current recipe worker code is :


async function handleRequest(request) {

return redirect(request, 'subdomain')


addEventListener('fetch', event => {

[login to view URL](handleRequest([login to view URL]))



* Returns a redirect determined by the country code

* @param {Request} request


function redirect(request) {

// The `cf-ipcountry` header is not supported in the previewer

const country = [login to view URL]('cf-ipcountry')

const url = countryMap[country]

return [login to view URL](url)



* A map of the url's to redirect to

* @param {Object} countryMap


const countryMap = {

"us" : "[login to view URL]",

"uk": "[login to view URL]"



this is redirect users to defined subdomain and i have tried some variables at the end like htaccess redirect :D but its not working any way i need to customize the code to redirect to the requested url with changing www to the subdomain based on defined country's in the recipe .

Thank You

Skills: PHP, JavaScript, WordPress, Software Architecture, Java

See more: cloudflare workers examples, cloudflare workers pricing, cloudflare workers html rewriter example, cloudflare workers sites, cloudflare workers cli, cloudflare workers redirect, cloudflare workers database, cloudflare worker return 404, custom google numbered map markers, custom markers directions map, custom united states map markers, custom google campus map, custom marker google map script, custom markers google map drupal, custom markers google map, draw custom circle google map, custom pins google map javascript, joomla custom html google map, custom marker google map, draw custom road google map

About the Employer:
( 1 review ) Cairo, Egypt

Project ID: #25658880

Awarded to:


Hi, I think I've already seen the issue and I can fix it in less than 1 hour. I've started working with cloudflare workers when they came out and I've had many projects with them before on freelancer. Write to me in More

$30 USD in 7 days
(9 Reviews)

3 freelancers are bidding on average $28 for this job


We are a team of expert WordPress developers having expertise in designing and developing eye-catchy, elegant, professional and responsive websites. We will give you quality , beautiful and smooth website with necessa More

$20 USD in 7 days
(41 Reviews)

Hi sir, I have read your description, I am an experienced Wordpress developer and expert at Wordpress website speed optimization. feel free to contact me!

$35 USD in 1 day
(3 Reviews)