Building modular, scalable web apps? of CORS!
summary
CORS is trivial to add in Ruby with rack-cors as middleware, and this enables a browser-side service-oriented architecture: a static HTML frontend on a CDN makes normal jQuery XHRs, sends a Bearer token in the URL hash, and uses an Ajax prefilter to attach an Authorization header to requests. The demo shows a Sinatra auth service (OmniAuth + Redis tokens) and a Sinatra stream service that verifies tokens via HTTP and accepts posts/gets — it works and lets services scale, reuse, and become public APIs (examples: GitHub, S3).
AI-written summary · about
chapters (7)
- 0:00Start
- 1:31Cross Origin Resource Sharing
- 5:01Access Control Headers
- 13:01Initial Complexity • Cross-Service Communication • Lack of Framework
- 17:30Let's Dig In!
- 32:41Famous Examples · GitHub: Entire API can be accessed via CORS • Amazon S3: Uploading now possible via 53
- 35:06Now you know what you can do with CORS today








