On Thu, May 15, 2014 at 12:16 PM, Florian Zumbiehl <florz@florz.de> wrote:
Hi,

> One way to do this is to write an appmod for your static file URL path that
> indicates the page to return along with the any extra headers for that
> page. Something like this:
>
> out(Arg) ->
>     ExtraHeaders = [{header, {"My-Special-Header", "foo"}}],
>     {page, {ExtraHeaders, Arg#arg.server_path}}.

thanks, that works in principle, though it has some weird behaviour:

When I DELETE an existing resource, for example, on the first request, I
get a 200 with the "deleted" entity in the body, but the file (luckily) at
least did not actually get deleted. A subsequent DELETE for the same path
gives me a 405, albeit without the mandatory Allow: header. I have worked
around both in my code for now ...

I assume for static resources you want to support only read methods like GET and OPTIONS. In that case you could have your appmod out/1 function check the requested method in the Arg and serve appropriate errors for DELETE and others.

--steve