[99s-extend] Rewriting URLs

Paul Dickson pdtwonotes at gmail.com
Mon Jan 26 06:09:49 CET 2015


Some progress.  I think this is how the code should look in my middleware:

execute( Req, Env ) ->
    HostUrl = cowboy_req:path(Req),
    NewUrl = rewrite( HostUrl ),
    NewReq = cowboy_req:set( [{path,NewUrl}], Req),
    {ok, NewReq, Env}.

It is getting called, but cowboy_static is being passed the wrong
thing afterward.  I think I do not understand how to write the
dispatch rule.  The value of NewUrl is an absolute filename.

    {"/music/[...]", cowboy_static, {dir, bz_libmap, ""}},


More information about the Extend mailing list