[99s-extend] Proposal for Cowboy Routing

Loïc Hoguin essen at ninenines.eu
Tue Nov 13 16:22:48 CET 2012


On 11/13/2012 04:12 PM, Thomas Allen wrote:
> On Tue, Nov 13, 2012 at 03:41:35PM +0100, Loïc Hoguin wrote:
>> Oh alright. Well they are equivalent URLs, so if you really need to
>> redirect I would do so in the handler directly, or through a request
>> hook.
>
> I suppose this suggests my next question ... how would one accomplish
> this right now in Cowboy? I hope I'm correct in assuming that this will
> involve cowboy_dispatcher:match/3 in an onrequest fun, but I do not
> understand how I will use match/3 with what I get from
> cowboy_req:path/1.

No, just check that cowboy_req:path/1 ends with $/, and if it doesn't 
then redirect.

-- 
Loïc Hoguin
Erlang Cowboy
Nine Nines
http://ninenines.eu



More information about the Extend mailing list