Regarding CORS issues displaying images in the Was...
# confetti
j
Regarding CORS issues displaying images in the Wasm based Compose for Web client, wondering if our backend might need to provide a proxy for them to get around this.
y
We could generalise the proxy I added for Wear?
j
Ah, forgot about that
y
It might even support not resizing already?
m
Problem is the url can be anything, right? Not only avatars?
y
Ahhh, damn.
m
We mentioned passing the full url as a query param at some point but there were issues with that, can't really remember what
besides the ugly urls πŸ˜…
I don't get the CORS issue. Shouldn't downloading an image be a "simple" request that doesn't need a preflight?
Reading this, I guess the user agents add a custom header or so
j
yeah, I've seen a few mentions of javascript fetch api using
no-cors
API
m
Can you customize Coil/AsyncImage to use
fetch
directly?
j
not sure if that can be done with typically ktor requests that those images libraries use
Can you customize Coil/AsyncImage to use
fetch
directly?
yeah, was wondering about that too
that person ended up using an image proxy
Used that https://confetti-app.dev/images/avatar/ request as quick test and works!
takes a while to load/show images in this view
y
Nice
j
I guess straight proxy should be faster
y
Maybe, but not sure.
I think spinning up service is more than the processing?
m
Nice!
This is what I have on the backend
I wonder why this is not cached by the CDN πŸ€”
y
+1, good catch
m
Attempt at adding a cache-control header: https://github.com/joreilly/Confetti/pull/1291/files
πŸ‘ 1
j
that seems to be working well now!
m
There's a 30min TTL so if you're unlucky you'll bump into the "slow" path but the more users the faster it'll be in average πŸ™‚
y
I wonder if CDNs have smarts to refresh just before expiry on a request?
πŸ‘€ 1
This item was valid 29 minutes ago, expiring in 1, might be a good win for p99 latencies
m
I'm not aware of any CDN doing this but would be pretty cool
I'm almost sure Google CDN doesn't
πŸ‘ 1
Like you can see the cache miss when doing curl manually (which would be really hard to trigger if it was refreshed automatically)
y
There is some heuristicy part of the max age spec, if that turns into conditional get, I'd hope the cache could keep itself fresh, based on updates headers. But I might need to dig in.
πŸ‘€ 1
j
switched to different conference and getting 500s now for some reason
y
Not an issue presumably a bug from whoever half assed that image proxy
j
I'll take a look at logs shortly
could be something on my side
m
Screenshot 2024-04-21 at 13.14.49.png
Looks like a non-existent speaker id πŸ€”
j
yeah, I think I messed up url formation
or at least it's not picking up correct conference for some reason
I'm using local published version of multiplatformsettings that has wasm support but possibly issue there still
yeah, it's happy now
πŸ‘ 1
what confused matters was that some images were showing.....but there were for people that were also in the other conference πŸ™‚
πŸ‘ 1