Ah, I see, I was looking at the example code in the Happstack documentation you linked. Looking at the documentation of Network.Socket I can see where it provides an option to bind on a particular address. The example given in the Happstack docs uses bindPort to get the socket which confused me as didn&#39;t realize you could initialize a socket using the Network.Socket functions and just pass that instead. The example in your latest mail is much clearer.<br>
<br clear="all">-R. Kyle Murphy<br>--<br>Curiosity was framed, Ignorance killed the cat.<br>
<br><br><div class="gmail_quote">On Thu, Mar 11, 2010 at 09:35, Martin Kiefel <span dir="ltr">&lt;<a href="mailto:mk@nopw.de">mk@nopw.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">On Thu, Mar 11, 2010 at 09:24:05AM -0500, Kyle Murphy wrote:<br>
&gt; You misunderstand his question. He&#39;s trying to setup happstack behind a<br>
&gt; reverse proxy running on the same system, so he needs to be able to bind it<br>
&gt; only to the loopback interface (127.0.0.1), as opposed to all the interfaces<br>
&gt; on the system (thereby making it inaccessible from the network unless<br>
&gt; accessed through the proxy). I don&#39;t know enough about happstack to answer<br>
&gt; his question, but I can see from the documentation you provided that there<br>
&gt; doesn&#39;t seem to be any way to specify address to bind to as Dmitry stated in<br>
&gt; his original e-mail.<br>
<br>
</div>But I&#39;m doing exactly that.<br>
<br>
Here is some of the code:<br>
<br>
main = do<br>
<br>
  ...<br>
<br>
  s &lt;- socket AF_INET Stream defaultProtocol<br>
  setSocketOption s ReuseAddr 1<br>
  h &lt;- getHostByName &quot;localhost&quot;<br>
  let p = toEnum $ port $ httpConf appConf<br>
  bindSocket s (SockAddrInet p (hostAddress h))<br>
  listen s 10<br>
<br>
  -- start the state system<br>
  control &lt;- startSystemState&#39; (store appConf) stateProxy<br>
<br>
  -- start the http server<br>
  httpTid &lt;- forkIO $ simpleHTTPWithSocket s (httpConf appConf)<br>
<br>
  ...<br>
<br>
And then my happstack server is just listening on 127.0.0.1.<br>
<br>
To access it, I&#39;m using Apache Proxy.<br>
<font color="#888888"><br>
- Martin<br>
</font><div><div></div><div class="h5"><br>
&gt;<br>
&gt; -R. Kyle Murphy<br>
&gt; --<br>
&gt; Curiosity was framed, Ignorance killed the cat.<br>
&gt;<br>
&gt;<br>
&gt; On Thu, Mar 11, 2010 at 07:39, Martin Kiefel &lt;<a href="mailto:mk@nopw.de">mk@nopw.de</a>&gt; wrote:<br>
&gt;<br>
&gt; &gt; Hi Dmitry,<br>
&gt; &gt;<br>
&gt; &gt; On Thu, Mar 11, 2010 at 11:38:44AM +0300, Dmitry V&#39;yal wrote:<br>
&gt; &gt; &gt; Hello haskellers,<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; I want to host a simple happstack application behind a reverse proxy. So<br>
&gt; &gt; &gt; ideally would be to bind it to localhost only.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; According to<br>
&gt; &gt; &gt;<br>
&gt; &gt; <a href="http://hackage.haskell.org/packages/archive/happstack-server/0.4.1/doc/html/Happstack-Server-HTTP-Types.html#t%3AConf" target="_blank">http://hackage.haskell.org/packages/archive/happstack-server/0.4.1/doc/html/Happstack-Server-HTTP-Types.html#t%3AConf</a><br>

&gt; &gt; &gt; Conf datatyle has only Port field. Does it mean, there is currently no<br>
&gt; &gt; &gt; way to prevent binding happstack to all available interfaces?<br>
&gt; &gt;<br>
&gt; &gt; I think you are looking for simpleHTTPWithSocket [1]. You can use<br>
&gt; &gt; whatever socket you like.<br>
&gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Regards,<br>
&gt; &gt; &gt; Dmitry<br>
&gt; &gt;<br>
&gt; &gt; Cheers,<br>
&gt; &gt; Martin<br>
&gt; &gt;<br>
&gt; &gt; [1]<br>
&gt; &gt; <a href="http://happstack.com/docs/0.4/happstack-server/Happstack-Server-SimpleHTTP.html#v%3AsimpleHTTPWithSocket" target="_blank">http://happstack.com/docs/0.4/happstack-server/Happstack-Server-SimpleHTTP.html#v%3AsimpleHTTPWithSocket</a><br>

&gt; &gt; _______________________________________________<br>
&gt; &gt; Haskell-Cafe mailing list<br>
&gt; &gt; <a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
&gt; &gt; <a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
&gt; &gt;<br>
</div></div></blockquote></div><br>