[erlang-questions] Force HTTP to HTTPS in Yaws

Michal Slaski <>
Mon Jul 7 15:38:47 CEST 2008


Hi Kimmo,

> How can I configure Yaws to force https? Like I would like any user
> that loads the
> site in http, to be redirected to https.

One way of doing it would be to change your yaws.conf file to have two
docroot directories. One for http and the other one for https.
https-docroot would be the one you are currently using. http-docroot
would contain index.yaws file only which would always redirect to
https. It could look like this (listing of index.yaws):

<erl>
out(A) ->
    {redirect,"https://localhost/"}.
</erl>

Change the above with your domain. This will however break any
functionality that was available through http.

Hope this helps,
Michal

-- 
Michal Slaski
http://www.erlang-consulting.com



More information about the erlang-questions mailing list