json-schema-org.github.io
json-schema-org.github.io copied to clipboard
Serve schemas with proper media-type usng Cloudflare and S3
Github Pages is not capable of serving our meta-schemas with the proper Content-Type: application-schema+json header. After learning about how @Relequestual used Cloudflare Workers to serve the blog as if it was part of the main website, it occurred to me that we could do the same thing with the meta-schemas and serve the schemas from AWS S3 where we can set proper media-types.
I setup a proof of concept to understand what's possible and what isn't. It turns out that this proxying of an external site isn't really a feature Cloudflare supports. Using workers to accomplish this is a hack. Unfortunately, the way workers work and the way they are billed, means that this simple task will incur some cost. The problem with workers is that they always run even if the result is cacheable and we would be charged for every use of the worker.
It's not entirely clear from Cloudflare's documentation, but I believe it would cost in the range of $15 - $25 a month. There should be no cost from S3 because that call is highly cacheable.