Giter Club home page Giter Club logo

Comments (8)

simonw avatar simonw commented on May 16, 2024

This means I need a good solution for these compile time options while running in development mode

from datasette.

simonw avatar simonw commented on May 16, 2024

How about when the service starts up it checks for a compile.json file and, if it is missing, creates it using the same code we run at compile time normally

from datasette.

simonw avatar simonw commented on May 16, 2024

Many of the applications I want to implement with this would benefit from having permanent real URLs.

So let’s have both. The sha1 urls will serve far future cache headers (and an etag derived from their path). The non sha1 URLs will serve 302 uncached redirects to the sha1 locations.

We will have a setting that lets people opt out of this behavior.

from datasette.

simonw avatar simonw commented on May 16, 2024

URL design:

 /database/table.json - redirects to /database-6753f4a/table.json

So we always redirect to the version with the truncated hash in the URL.

from datasette.

simonw avatar simonw commented on May 16, 2024

https://stackoverflow.com/a/18134919/6083 is a good answer about how many characters of the hash are needed to be unique. I say we default to 7 characters, like git does - but allow extras to be configured.

from datasette.

simonw avatar simonw commented on May 16, 2024

Can I take advantage of HTTP/2 so even if you get redirected I start serving you the correct resource straight away?

from datasette.

simonw avatar simonw commented on May 16, 2024

Looks like the easiest way to implement HTTP/2 server push today is to run behind Cloudflare and use this:

Link: </asset/to/push.js>; rel=preload; as=script

https://blog.cloudflare.com/announcing-support-for-http-2-server-push-2/

Here's the W3C draft: https://w3c.github.io/preload/

From https://w3c.github.io/preload/#as-attribute it looks like I should use as=fetch if the content is intended for consumption by fetch() or XMLHTTPRequest.

Unclear if I should throw as=fetch crossorigin in there. Need to experiment on that.

from datasette.

simonw avatar simonw commented on May 16, 2024

Here's what the homepage of cloudflare.com does (with newlines added within the link header for clarity):

$ curl -i 'https://www.cloudflare.com/' 
HTTP/1.1 200 OK
Date: Mon, 23 Oct 2017 21:45:58 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
link:
    </vendor/bitdashplayer.min.css>; rel=preload; as=style,
    </vendor/bitdash-controls.min.css>; rel=preload; as=style,
    </video/marketing-video/cloudflare-marketing-video.mpd>; rel=preload,
    </video/marketing-video/cloudflare-marketing-video.m3u8>; rel=preload,
    </video/marketing-video/video_0_800000/dash/init.mp4>; rel=preload; as=video,
    </video/marketing-video/audio_0_128000/dash/init.mp4>; rel=preload; as=video,
    </video/marketing-video/video_0_800000/dash/segment_0.m4s>; rel=preload; as=video,
    </video/marketing-video/audio_0_128000/dash/segment_0.m4s>; rel=preload; as=video,
    </video/new-short-optimized-22.mp4>; rel=preload; as=video,
    </video/marketing-video/poster.jpg>; rel=preload; as=image

The original header looked like this:

link: </vendor/bitdashplayer.min.css>; rel=preload; as=style, </vendor/bitdash-controls.min.css>; rel=preload; as=style, </video/marketing-video/cloudflare-marketing-video.mpd>; rel=preload, </video/marketing-video/cloudflare-marketing-video.m3u8>; rel=preload, </video/marketing-video/video_0_800000/dash/init.mp4>; rel=preload; as=video, </video/marketing-video/audio_0_128000/dash/init.mp4>; rel=preload; as=video, </video/marketing-video/video_0_800000/dash/segment_0.m4s>; rel=preload; as=video, </video/marketing-video/audio_0_128000/dash/segment_0.m4s>; rel=preload; as=video, </video/new-short-optimized-22.mp4>; rel=preload; as=video, </video/marketing-video/poster.jpg>; rel=preload; as=image

from datasette.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.