<p>Further, if you need to find out if the client is connecting with ssl, you can add an nginx (or apache) rule to add a custom header for clients connecting through ssl, then check for the existence of the header in nitrogen.</p>

<p>The main reason I'd do that is to minimize the number of servers with the ssl cert installed. Though in the long run, for performance, you can switch all static files to be served from nginx/apache, and leave all the dynamic stuff to nitrogen/inets.</p>

<p>But if this isn't exactly a high performance app, then most of this of overkill anyway.</p>
<p>--<br>
Jesse Gumm<br>
Owner, Sigma Star Systems<br>
414.940.4866<br>
<a href="http://www.sigma-star.com">www.sigma-star.com</a><br>
@jessegumm</p>
<div class="gmail_quote">On Mar 14, 2012 8:39 PM, "Motiejus Jakštys" <<a href="mailto:desired.mta@gmail.com">desired.mta@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Wed, Mar 14, 2012 at 19:46, John Hughes <<a href="mailto:john.hughes@quviq.com">john.hughes@quviq.com</a>> wrote:<br>
> Hi Jesse,<br>
><br>
> Thank you! That sounds like just what I need. I didn't realise wf:socket()<br>
> would tell me the socket type--very useful!<br>
><br>
> I am actually using Apache as a reverse proxy to forward port 80 to 8000<br>
> already... my problem is I want to access the *same page* (i.e. same .erl<br>
> file) through http and https, and see different options in each case. I<br>
> suppose I could make two different pages, but that would be more complex and<br>
> less maintainable however I did it (code duplication or a more complex<br>
> module structure). I'm not sure nginx would really solve that problem for<br>
> me.<br>
<br>
Depends where you want routing decisions to be handled. In front<br>
webserver (nginx) or in Erlang application?<br>
<br>
If in a-la-nginx, simply configure access rules for both http and<br>
https virtualhosts individually.<br>
If nitrogen case, I would think about doing the Erlang application on<br>
a single http port, and using a real web server to make "real" 80 and<br>
443. And append some kind of header in each case (X-port: 80/443 for<br>
instance).<br>
<br>
I don't know the exact syntax for web servers, but should be easy to<br>
figure it out.<br>
<br>
Motiejus Jakštys<br>
</blockquote></div>