[erlang-questions] HTTPS and Basic Authentication with Erlang

David Wright david.g.wright@REDACTED
Wed Feb 15 09:37:36 CET 2017


I apologize for not wording my question appropriately.

With the previous example it will use https to serve documents found in the document_root. However I would like to write a restful API and decode the URL and obtain parameters for the API method. I was wanting an example of how this is done in erlang and not something like cowboy or Chicago Boss. I have read about tls and ssl but failed to find how to achieve what I need with https.

Namaste'
David Gray Wright

> On 15 Feb 2017, at 6:11 pm, Kenneth Lakin <kennethlakin@REDACTED> wrote:
> 
>> On 02/14/2017 09:00 PM, David Wright wrote:
>> I am after an Erlang only example or is using a framework (http server)
>> like cowboy the only way?
> 
> You can serve HTTP over SSL/TLS with erlang's httpd module:
> 
> Erlang/OTP 19 [erts-8.2] [source] [smp:2:2] [ds:2:2:10]
> [async-threads:10] [hipe] [kernel-poll:true]
> 
> Eshell V8.2  (abort with ^G)
> 1> application:ensure_all_started(inets).
> {ok,[inets]}
> 2> inets:start(httpd, [{port, 8443}, {server_root, "."}, {server_name,
> "localhost"}, {document_root, "."}, {socket_type, {essl, [{certfile,
> "server.pem"}]}}]).
> {ok,<0.77.0>}
> 3>
> 
> $ curl -k https://localhost:8443/index.html
> <html>
>  <body>
>    hello
>  </body>
> </html>
> $
> 
> 
> See <http://erlang.org/doc/man/httpd.html> for more info. I don't know
> about Basic Auth but the "Authentication Properties" section in the
> documentation looks promising.
> 
> 



More information about the erlang-questions mailing list