Skye
02/19/2023, 1:51 PMasd.pdf
, that will be what's in key
Mr.Kevin
02/19/2023, 1:53 PMSRS - english.pdf
and get the key files/a-uYgM0r4crU6Lw1-yDIn/0000000000
Skye
02/19/2023, 1:54 PMMr.Kevin
02/19/2023, 1:54 PMSkye
02/19/2023, 1:58 PMkey
is definitely the filename
js
export default {
async fetch(request, env) {
const { objects } = await env.R2.list();
return Response.json(objects.map(x => x.key))
}
}
The above code produced the following output, which is exactly what I'd expect json
["rank-cards/0.png","rank-cards/1.png","rank-cards/10.png","rank-cards/11.png","rank-cards/2.png","rank-cards/3.png","rank-cards/4.png","rank-cards/5.png","rank-cards/6.png","rank-cards/7.png","rank-cards/8.png","rank-cards/9.png"]
Scheggia
02/19/2023, 2:20 PMcdn.domain.com
and so the images are displayed as cdn.domain.com/images/myimage.png
.
Can I make those loaded through img.domain.com
lead directly to the /images subfolder of the main domain, so img.domain.com/myimage.png
?Deleted User
02/19/2023, 2:28 PMDeleted User
02/19/2023, 2:29 PMimg
subdomain since rewrite rules rewrite on the same hostScheggia
02/19/2023, 2:45 PMErisa | Support Engineer
02/19/2023, 2:46 PMErisa | Support Engineer
02/19/2023, 2:47 PMScheggia
02/19/2023, 2:48 PMScheggia
02/19/2023, 2:48 PMErisa | Support Engineer
02/19/2023, 2:48 PMMr.Kevin
02/19/2023, 2:56 PMSkye
02/19/2023, 3:04 PMScheggia
02/19/2023, 3:04 PM(starts_with(http.request.full_uri, "https://img.mydomainhere.com/"))
and Path > Rewrite to > Dynamic:
concat("/i", http.request.uri.path)
But it doesn't seem to be working... If I deactivate the rule and go to img.domain.com/i/myimage.png
it works, then activating it and going to img.domain.com/myimage.png
it returns 404 so it doesn't redirect correctly. I also cleared the browser cache and Cloudflare cache.Mr.Kevin
02/19/2023, 3:05 PMErisa | Support Engineer
02/19/2023, 3:07 PMconcat("/avatars", http.request.uri.path)
on r2.erisa.uk
and now ▾
▾
Erisa | Support Engineer
02/19/2023, 3:08 PMScheggia
02/19/2023, 3:09 PMScheggia
02/19/2023, 3:21 PM▾
▾
concat("/images", http.request.uri.path)
Skye
02/19/2023, 3:22 PMSkye
02/19/2023, 3:23 PM/images
to the start of the path and fetches itErisa | Support Engineer
02/19/2023, 3:23 PMSkye
02/19/2023, 3:23 PMScheggia
02/19/2023, 3:24 PMErisa | Support Engineer
02/19/2023, 3:24 PMErisa | Support Engineer
02/19/2023, 3:24 PMScheggia
02/19/2023, 3:25 PM