<div dir="ltr">I explicitly described a scenario in my email. Can you tell me more about what you want me to describe? Unless you consider my Vault alternative as not in the Request.<div class="gmail_extra"><br></div><div class="gmail_extra">

Not sure what backend couldn&#39;t reliably tell whether *it* was connected to securely. None can make claims about other steps in the chain (Which is also exactly why we need this value).</div><div class="gmail_extra"><br>

</div><div class="gmail_extra">-davean<br><br><div class="gmail_quote">On Wed, Jul 24, 2013 at 11:29 AM, Michael Snoyman <span dir="ltr">&lt;<a href="mailto:michael@snoyman.com" target="_blank">michael@snoyman.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">My concern is that, by throwing in as much information as possible in Request, we&#39;ll essentially be diluting the meaning of the values there. My approach was to only include values in Request that can be reliably reported by all backends, or at the very least would clearly be nonsense for certain backends[1]. My big concern is making it easy to write incorrect code. My question is: what is a concrete example where you would want the isSecure field in Request? If you&#39;re talking about a case where you&#39;re using warp-tls and no reverse proxies, then you can tell your application (via a config parameter, for example) that this is the case.<div>



<br></div><div>Maybe I just don&#39;t have the right mental model for what people are expecting for WAI. I want to understand the use cases better, so please keep up the discussion :).<br><div><br></div><div>[1] Example: wai-test clearly has to provide a fake IP address for the remote end of the connection.</div>



</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jul 24, 2013 at 6:10 PM, davean <span dir="ltr">&lt;<a href="mailto:davean@xkcd.com" target="_blank">davean@xkcd.com</a>&gt;</span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Clients directly accessing the server also makes sense when you have tens of thousands of open connections at a time (that would be me). The proxy overhead is just silly.<div><br></div><div>As for HTTPS, isSecure is interesting when using something like warp-tls so as to handle insecure connections more elegantly. While the server can&#39;t know about if a proxy received a secure connection it can know if it did. This is even interesting when using a proxy since if the proxy is on another system it should still connect with HTTPS for a large number of threat models. Of course one may put that in the Vault.</div>





<div><br></div><div>And don&#39;t forget CDN updates where connections that were being sent as HTTPS start being sent as HTTP due to the CDN operator&#39;s error. Perhaps you still want to serve most connections when they come in as HTTP from the CDN, send a warning to the ops team, and deny some requests as too sensitive? Plenty of cases here.</div>





<div><br></div><div>This isn&#39;t about the entire history of the connection, it is about conveying the webserver&#39;s information to the app so the app writer can make appropriate choices to figure out what the history actually is given their specific situation.</div>





<div><br></div><div>-davean</div><div><br></div><div>PS: The below happens BTW:</div><div><br></div><div>client &lt;-&gt; their work&#39;s proxy &lt;-&gt; their ISP&#39;s proxy &lt;-&gt; CDN &lt;-&gt; provider&#39;s proxy &lt;-&gt; final HTTP server</div>





<div><br></div><div>That is forwarded 4 times. Of course someone in there can also be lying. I&#39;ve even seen some pretty clever goes at forging X-Forward-Fors through (or around) proxies.</div><div><br></div></div><div>



<div><div class="gmail_extra">

<br><br><div class="gmail_quote">On Wed, Jul 24, 2013 at 9:59 AM, Federico Mastellone <span dir="ltr">&lt;<a href="mailto:fmaste@gmail.com" target="_blank">fmaste@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div dir="auto"><div><span>Wai should provide &quot;</span><span style="text-align:left;background-color:rgba(255,255,255,0)">a common protocol for communication between web applications and web servers.&quot;, using proxies, load balancers or not. </span><span style="background-color:rgba(255,255,255,0);text-align:left">I use Wai in a small setup (measured by clients), where clients access the server directly. I was even going to request support for client certificates. </span></div>





<div><span style="text-align:left;background-color:rgba(255,255,255,0)"><br></span></div><div><span style="text-align:left;background-color:rgba(255,255,255,0)">Because some fields are unknown when running behind Amazon ELB I don&#39;t think they should be taken out of the Wai interface. In that case, that fields could be Nothing, False, etc. I think it would be great to write an Application that can be run with any Wai compatible server, and maybe later warp supports this fields behind a reverse proxy. </span></div>





<div><div><div><br>On 24/07/2013, at 09:23, Michael Snoyman &lt;<a href="mailto:michael@snoyman.com" target="_blank">michael@snoyman.com</a>&gt; wrote:<br><br></div><div><span></span></div><blockquote type="cite">

<div><div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jul 24, 2013 at 3:08 PM, Kazu Yamamoto <span dir="ltr">&lt;<a href="mailto:kazu@iij.ad.jp" target="_blank">kazu@iij.ad.jp</a>&gt;</span> wrote:<br>







<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Michael,<br>
<div><br>
&gt; I&#39;m definitely not talking about removing the peer information. Request has<br>
&gt; a remoteHost field which is of type SockAddr, and therefore provides both<br>
&gt; remote IP address and port number (the latter, as you mention, being mostly<br>
&gt; useless).<br>
<br>
</div>Please understand that I&#39;m not opposing your opinion. I&#39;m just trying<br>
to interpret user&#39;s opinions.<br>
<div><br></div></blockquote><div><br></div><div>I appreciate the input, I just wanted to clarify my proposal.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">







<div>
&gt; I&#39;m not sure what you mean by telling if communication is encrypted using<br>
&gt; the headers + IP address, can you clarify?<br>
<br>
</div>Suppose a Yesod application receives X-Forwarded-For:.<br>
<br>
A bad client can insert X-Forwarded-For:. But if an IP address is<br>
provided and the application knows the IP address of the proxy, the<br>
application can tell whether or not the IP address can be trusted.<br>
<br>
I&#39;m not sure that there is a standard header field to tell HTTPS.<br>
But if the proxy and the application shares such field:<br>
- The application can truct the field according peer&#39;s IP address<br>
- The application can tell the outside HTTP is encrypted<br>
<br>
Correct me if I misunderstand.<br>
<span><font color="#888888"><br></font></span></blockquote><div><br></div><div>I&#39;d never considered checking the IP address of the proxy. When I&#39;ve used X-Forwarded-For, I&#39;ve always made sure to set up a firewall to ensure the *only* connections come from the reverse proxy, and then x-forwarded-for can be trusted.</div>







<div><br></div><div>As far as determining secure/insecure, it seems like Amazon&#39;s ELB sets x-forwarded-proto[1]. Not sure if that&#39;s a well accepted standard, but it seems useful.</div><div><br></div><div>Michael</div>







<div><br></div><div>[1] <a href="http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/TerminologyandKeyConcepts.html#x-forwarded-proto" target="_blank">http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/TerminologyandKeyConcepts.html#x-forwarded-proto</a></div>







</div></div></div>
</div></blockquote></div></div><blockquote type="cite"><div><span>_______________________________________________</span><div><br><span>web-devel mailing list</span><br><span><a href="mailto:web-devel@haskell.org" target="_blank">web-devel@haskell.org</a></span><br>





<span><a href="http://www.haskell.org/mailman/listinfo/web-devel" target="_blank">http://www.haskell.org/mailman/listinfo/web-devel</a></span><br></div></div></blockquote></div><br>_______________________________________________<br>






web-devel mailing list<br>
<a href="mailto:web-devel@haskell.org" target="_blank">web-devel@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/web-devel" target="_blank">http://www.haskell.org/mailman/listinfo/web-devel</a><br>
<br></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
web-devel mailing list<br>
<a href="mailto:web-devel@haskell.org" target="_blank">web-devel@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/web-devel" target="_blank">http://www.haskell.org/mailman/listinfo/web-devel</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div></div>