已完成

cloudflare workers custom recipe

Hello

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

技能: PHP, JavaScript, WordPress, 软件构架, Java

查看更多: 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

关于此雇主:
( 1条评论 ) Cairo, Egypt

项目ID: #25658880

授予:

PaoloBarbolini

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 更多

$30 USD 在7天内
(9条评论)
3.6

3 威客就此工作平均出价 $28

codetechservices

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 更多

$20 USD 在7天内
(41条评论)
6.1
usmanbinwaheed

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!

$35USD 在1天里
(3条评论)
3.1