[erlang-questions] Force HTTP to HTTPS in Yaws
mog
mog-lists@REDACTED
Tue Jul 8 23:46:08 CEST 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Kimmo Gläborg wrote:
|>> 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.
|
| Thanks Michal! I probably would like to keep the http environment
| working aswell.
| Isn't there a way to configure this in the Yaws config environment? (I
| believe this is
| just a setting, both in IIS and Apache for example..)
|
| // kimmo
| _______________________________________________
| erlang-questions mailing list
| erlang-questions@REDACTED
| http://www.erlang.org/mailman/listinfo/erlang-questions
its pretty easy to get it going the way you want here is https redirect
i wrote once
%%%http_redirect.erl%%%-----------------------------------------------------
- -module(http_redirect).
- -include("/usr/local/lib/yaws/include/yaws_api.hrl").
- -export([out/1]).
~ Path = Args#arg.server_path,
~ Redirect = lists:append("https://www.YOURDOMAINHERE.com", Path),
~ {redirect, Redirect}.
%%%yaws.conf-------------------------------------------------------
.....
<server redirect>
~ port = 80
~ listen = 0.0.0.0
~ appmods = <"/", http_redirect>
~ docroot = /usr/local/var/yaws/ebin
</server>
.....
%%%%%-----------
hope this helps mog
mog
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFIc+Aeeq+tARrxhnsRAt7PAKCOKRc7nOEuCJt4tyQ7q2GIAJS2ngCdGUxm
ibGbptmFI0sOAIc7i6sYypQ=
=pjFt
-----END PGP SIGNATURE-----
More information about the erlang-questions
mailing list