Closed leoliu closed 5 years ago
Have you tried {page, Path}
?
{page, Page}
Make Yaws returns a different local page than the one being requested. Page
is a Request-URI, so it must be url-encoded and can contain a query-string.{page, {Options, Page}}
Like the above, but supplying an additional deep list of options. Sup- ported options types are:
{status, C}
- Set the HTTP response status code C
for page Page
.{header, H}
- Accumulate the HTTP header H
for page Page
.{disable_cache, Bool}
- if set to true, disable the cache of Page
for this call.@vinoski,
I was looking at {page, ...}
before opening this bug but somehow I dismissed it before even trying it out. I have just done that and it seems to be the solution I was looking for. Thanks for the pointer. Closing for now.
Leo
I have been wondering about a (hidden) feature for a few months.
Yaws can serve static files with support for conditional and range requests. However such feature is not easily available to a user-supplied appmod. I have seen a few scenarios where a appmod needs to process the request - authentication, DB lookup etc. - then deliver a private static file if conditions are met. i.e. I was wishing for something like this:
out/1
returns{sendfile, PathToFile}
or{sendfile, Headers, PathToFile}
andYaws
figures out the best way to deliver it to the clients with proper handling of conditional and range requests.Such feature is not unlike the xsendfile feature provided by reverse proxies such as nginx, apache, h2o etc.