8

I am using Mojolicious for a web app that requires an encrypted connection, but I don't know how to add SSL support to Mojolicious.

My coworker sent me these: files domain.key, domain-bundle.crt, domain.crt

and my Mojolicious startup looks like this:

sub startup {
my $self = shift;
$self->secrets(['secretphrase']);
$self->config(hypnotoad => {listen => ['http://*:80']});

How can I add HTTPS support without having to use a reverse-proxy

user2348668
  • 718
  • 5
  • 19
  • 1
    You have to configure your web server (Apache, IIS etc) to perform the SSL encryption. Mojolicious is a web framework, not a web server. – stevieb Dec 09 '15 at 01:51
  • 3
    @stevieb the question suggests that the app is using Hypnotoad which is indeed a web server and can support TLS - [this page](https://metacpan.org/pod/Mojo::Server::Daemon#listen) has some config details. While you can put Apache or Nginx in front of hypnotoad, that might not work well if websockets were being used. – Grant McLean Dec 09 '15 at 02:39

1 Answers1

13

Found how to do it:

sub startup {
my $self = shift;
$self->secrets(['secretphrase']);
$self->config(hypnotoad => {
      listen => ['https://*:443?cert=/etc/tls/domain.crt&key=/etc/tls/domain.key']
  });
Yordan Georgiev
  • 4,006
  • 1
  • 43
  • 47
user2348668
  • 718
  • 5
  • 19