You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An automated redirection from https://services.gradle.org/distributions/<something>.zip or https://downloads.gradle.org/distributions/<something>.zip to China CDN https://downloads.gradle-dn.com/distributions/<something>.zip
Current Behavior
Just a Cloudflare CDN, very slow in China.
Context
I think it's better to redirect the download links to China CDN for users in China.
Cloudflare provides a function named IP Geolocation, so I think you can set some redirect rules using the header CF-IpCountry so that we users will not need to modify the file gradle\wrappers\gradle-wrapper.properties or download the .zip files manually.
I think there are two options:
Configure redirection rules on your original server.
Use the Workers function provided by Cloudflare.
example code:
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
async function handleRequest(request) {
let url = new URL(request.url)
if (url.pathname == "/") {
let country = request.headers.get("CF-IpCountry")
if(country=="CN"){
url.host = "test.example.com"
}
return Response.redirect(url, 302)
}
}
The text was updated successfully, but these errors were encountered:
Expected Behavior
An automated redirection from
https://services.gradle.org/distributions/<something>.zip
orhttps://downloads.gradle.org/distributions/<something>.zip
to China CDNhttps://downloads.gradle-dn.com/distributions/<something>.zip
Current Behavior
Just a Cloudflare CDN, very slow in China.
Context
I think it's better to redirect the download links to China CDN for users in China.
Cloudflare provides a function named
IP Geolocation
, so I think you can set some redirect rules using the headerCF-IpCountry
so that we users will not need to modify the filegradle\wrappers\gradle-wrapper.properties
or download the.zip
files manually.I think there are two options:
example code:
The text was updated successfully, but these errors were encountered: