[99s-extend] Rewriting URLs

Paul Dickson pdtwonotes at gmail.com
Tue Jan 27 14:07:48 CET 2015


On Tue, 2015-01-27 at 11:13 +0100, Loïc Hoguin wrote:
> On 01/26/2015 10:54 PM, Paul Dickson wrote:
> > On Mon, 2015-01-26 at 11:26 +0100, Loïc Hoguin wrote:
> >> You have to change path_info too if your middleware is after the router.
> >>
> > I have added that.  My cowboy:start_http parameters include this:
> >      {middlewares, [cowboy_router, bz_libmap, cowboy_handler]}
> > which I think means bz_libmap will get called on *every* request.  This
> > seems to work.  Among the dispatch rules is this line:
> >      {"/music/[...]", cowboy_static, {dir, "", ""}},
> 
> Is it the actual line? Cause {dir, "", ""} is wrong, the third element 
> must be an etag or mimetype tuple.
> 
> Otherwise, I need a more complete error, or code.

I changed the rule line to:

	    {"/music/[...]", cowboy_static, {dir, "", [
	        {mimetypes, cow_mimetypes, all}]}},

The client I am using is 'mplayer'.  The error message is:

  Server returned 400:Bad Request
  Failed to parse header.
  Failed, exiting.

I also included some tracing in my middleware module to print
out the new path and path_info values it is setting, showing
the result of the rewrite algorithm.

 Path <<"/music/Library/Folk/Swiss/Alphorn.ogg">>
 Info [<<"/">>,<<"music">>,<<"Library">>,<<"Folk">>,<<"Swiss">>,
         <<"Alphorn.ogg">>]




More information about the Extend mailing list