Right, I have two problems to solve today before I can release a big new @manyfold feature.
1) Bootstrap's collapse refuses to hide a section on page load
2) Fetching files from S3 is being very very slow in my Ruby code, but not with the same presigned link in a browser.
All the code that I spent ages refactoring to do this feature has worked pretty much perfectly; I'm being let down by just those two little details.
Problem #1 is down, thanks to a rubberduck from @pixel. Now, problem #2, I'm coming for you.
Right, interesting.
* `mc get <url>` is millisecond fast.
* `curl <url> -o out.stl` from a rails console is still millisecond fast.
* `curl <url>` from rails console is dog slow
* `file.attachment.read` in rails console is same dog slow
So, my problem is not AWS-side, it's in marshalling the download deep down on the Ruby side. Which is not unexpected, but *is* annoying, because it's quite hidden away from the level I'm working at.
Still, progress.
OK, good, this is in fact exactly the same problem that makes mesh loading so slow, so it's not going to make anything *worse*. Which means that if I just can change download to use presigned URLs.... bingo, release time.
....you wanted a stream of development consciousness, right?
Right. Redirection to a presigned URL works nice and quick, that's good. BUT, my Content-Security-Policy is blocking the content. So, next challenge, how to either get a nonce into the S3 response, or otherwise allow the content. Bearing in mind that the entire storage thing is dynamic and I don't know the bucket name at application boot time so I can't just hardcode it.
Having some way to tell S3 to include a nonce in its response would be best, but I've not found an option for that yet that works in the presigned URL generation. Must be something somewhere.
Well, there wasn't a way to do what I wanted, but I worked out how to dynamically change the CSP header to include the domains of any S3 object stores in use, so it works.
I think it might be time for another round of optimisation again soon though.
@floppy Yes. Always interesting to hear what issues others are dealing with