Skip to content

The Exponent server that hosts rich articles written with JavaScript and React Native

License

Notifications You must be signed in to change notification settings

codeforus/exponent-host

 
 

Repository files navigation

exponentjs.com Slack

This is the Exponent hosting service, which includes the React Native packager cluster and the https://exponentjs.com and https://exp.host websites.

How are things set up?

See QUICKSTART.md for setup instructions.

CDN

Static resources are served from AWS CloudFront, which caches the resources and serves them quickly to users worldwide. The domain of our CloudFront is http://static.exponentjs.com. When you visit one of our CDN URLs that CloudFront doesn't have cached, it retrieves the static resources on-demand from the origin server at https://exponentjs.com/assets.

The filenames of the static resources are generated by webpack and are computed by hashing the resources; this means that a resource's filename and URL don't change unless the resource's content changes. This is great for caching as we don't need to implement cache invalidation and CloudFront and browsers can cache the static resources indefinitely. The origin's response includes Cache-Control headers that tell CloudFront to cache the resources for a sufficiently long time like a year. As an emergency switch, our static resource URLs contain v${version}, where ${version} is a digit that acts as a cache breaker.

So, when you visit http://static.exponentjs.com/v0/pmEUQbj7N1m95nXyF7j7.png the following happens when all caches are empty:

  1. Your client looks for the URL in its local cache, doesn't find it, and makes a request to the server
  2. http://static.exponentjs.com points to CloudFront, which looks up the URL in its cache. CloudFront will ignore HTTP headers and query parameters.
  3. CloudFront constructs the URL to the origin server and makes a request to http://exponentjs.com/assets/v0/pmEUQbj7N1m95nXyF7j7.png
  4. The origin server at http://exponentjs.com routes the request to the asset handler, which serves the file at build/web/assets/pmEUQbj7N1m95nXyF7j7.png. The version part of the path is ignored; it is solely for bypassing CloudFront's cache.

About

The Exponent server that hosts rich articles written with JavaScript and React Native

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 93.1%
  • CSS 6.0%
  • HTML 0.9%