[99s-extend] Rewriting URLs
Loïc Hoguin
essen at ninenines.eu
Mon Jan 26 11:26:42 CET 2015
You have to change path_info too if your middleware is after the router.
On 01/26/2015 06:09 AM, Paul Dickson wrote:
> 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, ""}},
> _______________________________________________
> Extend mailing list
> Extend at lists.ninenines.eu
> https://lists.ninenines.eu/listinfo/extend
>
--
Loïc Hoguin
http://ninenines.eu
More information about the Extend
mailing list