Module Webs_kit.Gateway

Gateway interaction.

File serving handoff

See this section of the web service howto.

val send_file : -> Webs.Req.t -> Webs.Http.fpath -> (Webs.Resp.t'e) Stdlib.result

send_file ~header r file lets the gateway respond to r with file file, use Req_to.absolute_filepath to determine one from r safely. More precisely this a Webs.Http.s200_ok empty response with:

  • Header header set to file. The actual header to use depends on your gateway.

Note. The gateway docs of this mecanism are unclear whether we should also transfer some of r's headers in the response e.g. the etag and conditional headers but at least with Nginx that doesn't seem to be the case.

val x_accel_redirect :

x_accel_redirect is the header name "x-accel-redirect" used by Nginx for internal redirection.

val x_sendfile :

x_sendfile is the header name "x-sendfile". Used by Apache and Lighttpd for file serving.