Buuntu has asked for the wisdom of the Perl Monks concerning the following question:

I'm following the instructions on CPAN for setting up SSL (http://search.cpan.org/~hobbestig/Dancer-Plugin-RequireSSL-0.121331/lib/Dancer/Plugin/RequireSSL.pm) and I'm not sure whether it's working.

My perl dancer script loads up fine with no errors or warnings but it looks like the URL is still HTTP, is that just because I'm accessing it through localhost:3000? Trying to access https://localhost:3000 just tells me the page doesn't exist.

Will it work fine once I deploy the website to a real server or is there still something I have to configure for it to work (do I have to install SSL somehow)? Do I have to set the port to 80 or 443 instead of the default 3000?

Replies are listed 'Best First'.
Re: Perl Dancer and SSL setup
by trippledubs (Deacon) on Sep 05, 2014 at 18:25 UTC
    From the source it looks like it just sends a redirect from http://<page> to https://<page> if the server is not in development mode. It doesn't actually set up the encryption for you. So you would already have to have the secure version of the page working, and then this module would redirect from the insecure page to the secure page. There are plenty of tutorials on how to set up ssl, depending on your configuration. Generally involves making a certificate using openssl or some other tool, optionally getting it signed by a Certificate Authority, and then configuring your web server to utilize that certificate, conventionally listening on non secure port 80 and additionally with the certificate option on port 443.

    After all that is working, it looks like that module redirects all traffic. So if you navigate to http://website.com, Dancer will tell your browser to go to https://website.com. And so on for every valid page that Dancer is responsible for. That is all that module does, looks like to me.
Re: Perl Dancer and SSL setup
by Anonymous Monk on Sep 05, 2014 at 20:20 UTC