[erlang-questions] HTTPS and Basic Authentication with Erlang

Kenneth Lakin kennethlakin@REDACTED
Wed Feb 15 08:11:17 CET 2017


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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: OpenPGP digital signature
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170214/574a5e6d/attachment.bin>


More information about the erlang-questions mailing list