Here s a quick snippet for you that

Here's a quick snippet for you that should work:
export default {
async fetch(request: Request) {
if (new URL(request).pathname === '/app') {
const ua = request.headers.get('user-agent')
if (ua.toLowerCase().includes('android')) {
return Response.redirect(playstoreUrl, 301)
} else {
return Response.redirect(appstoreUrl, 301)
}
} else {
// serve a 404, your origin, or something else
}
}
export default {
async fetch(request: Request) {
if (new URL(request).pathname === '/app') {
const ua = request.headers.get('user-agent')
if (ua.toLowerCase().includes('android')) {
return Response.redirect(playstoreUrl, 301)
} else {
return Response.redirect(appstoreUrl, 301)
}
} else {
// serve a 404, your origin, or something else
}
}
1 Reply
kb
kb3y ago
Thank you, i'll check this out and go from there :)
Want results from more Discord servers?
Add your server