erlangyaws

Yaws code inside <erl></erl> not running


I am trying out Yaws, however I have run into a bump. The code inside my .yaws file is not compiling when I got to the path, instead it is being printed on the window. Here is my code and configuration:

<erl>
method(Arg) ->
    Rec = Arg#arg.req,
    Rec#http_request.method.

out(Arg) ->
    {ehtml, f("Method: ~s", [method(Arg)])}.
</erl>

Server configuration:

<server localhost>
    port = 8000
    listen = 127.0.0.1
    docroot = /home/something/
    dir_listings = true
    dav = true
    auth_log = true
    statistics = true
</server>

Any info would really be appreciated, thank you.


Solution

  • The problem is that you have dav = true in your server configuration, which turns on WebDAV, a protocol for content management. Under this configuration, a .yaws file is treated as just a regular file, not as one that requires special Yaws processing, which is why you see the verbatim contents of the file when you access it via your browser.

    Removing dav = true from your configuration and then restarting Yaws will make it process your example.yaws file as you expect.