Module Webs_kit.Gateway

Gateway interaction.

File serving handoff

See this section of the web service howto.

val send_file : -> Webs.Http.req -> Webs.Http.fpath -> (Webs.Http.resp, '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.ok_200 empty response with:

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

Note. The gateway docs of this mechanism 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.