<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, May 20, 2013 at 10:25 AM, Loïc Hoguin <span dir="ltr"><<a href="mailto:essen@ninenines.eu" target="_blank">essen@ninenines.eu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 05/20/2013 01:53 PM, Eduardo Gurgel wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
<br>
<br>
<br>
On Sun, May 19, 2013 at 10:01 PM, Eduardo Gurgel <<a href="mailto:edgurgel@gmail.com" target="_blank">edgurgel@gmail.com</a><br></div><div class="im">
<mailto:<a href="mailto:edgurgel@gmail.com" target="_blank">edgurgel@gmail.com</a>>> wrote:<br>
<br>
    I want to write a cowboy middleware that works only on non-websocket<br>
    requests. How can I achieve this? Is there any way that I ask the<br>
    Request if this is a websocket request?<br>
<br>
<br>
Thinking about my question, I see that the middleware (if it's behind<br>
the cowboy_handler) can't figure if the connection will be upgraded or not.<br>
<br>
Still, it would be cool if I could select which routes will be applied<br>
to my middleware.<br>
</div></blockquote>
<br>
You have the Req which can help you do things based on host or path, and you also have the environment, which contains the name of the handler that's gonna be used if you execute your middleware after cowboy_router.<span class="HOEnZb"><font color="#888888"><br>

<br></font></span></blockquote><div><br></div><div style>Perfect! The environment can help me :)</div><div><br></div><div><br></div><div style>Thank you, again!</div></div><div><br></div>-- <br><div dir="ltr">Eduardo<br>
</div>
</div></div>