<pre>
elementfetch
and insert that content into <pre>
tag. Browsers restrict ability to use fetch
requests either to the same domain that is issuing a request or to a domain that explicitly allows access by anyone by setting the right CORS headers in responses. Unfortunately while we can get a public URL for any S3 file by using pre-signed urls, s3 servers by default don’t support CORS. To make it work the owner would have to configure the bucket properly, which is way too much to ask for users of an app like Filerion. The fix for this is relatively simple: write a proxy which will get the content for us. It could be done in Go backend but I chose to use Cloudflare workers instead. Mostly because Cloudflare bandwidth is much cheaper. Getting to learn a new technology is a bonus.