The request pipeline
Flowchart from the Technical Manual.
Text version
- HTTPS request
- drainBeforeClose() (reads the body before closing a connection)
- pathRequestsOnly() (400 if the URL is not a path)
- Polka app
- nosniff
- thrown or passed errors: ServerError (onError)
- nosniff
- request-log
- CORS
- HSTS (production)
- stats
- request and response helpers
- domain redirects
- trailing slashes
- local redirects
- sessions (attached, not stored)
- /š±/development-socket/ (development)
- Kittenās internal web app routes
- /uploads/:id/:download?
- routes and middleware added by main.script.js through router (if any)
- App routes, in route order
- __archive__1, __archive__2, and __archive__3 (static)
- no handler ends the response: noMatchHandler() (onNoMatch)
- noMatchHandler() (onNoMatch)
- an upgrade: 404 written to the socket, which is destroyed
- any other request (404): ServerError (onError)
- 404 written to the socket, which is destroyed
- ServerError (onError)
- Each routeās routeHandler(): passes upgrades on (except socket routes), requires sign-in (š), then the route parses its body and runs