Authentication and/or HTTPS with Plack/PSGI/Poet application

The Apache config looks like this, if you go with Plack+Apache/mod_perl

<Location /path/myapp>
  SetHandler perl-script
  PerlResponseHandler Plack::Handler::Apache2
  PerlSetVar psgi_app /path/to/my.psgi
</Location>

Another more simple option is to use what's built into plackup, Starman, and Thrall:

plackup --enable-ssl --ssl-key-file=... --ssl-cert-file=...

(or)

starman --enable-ssl --ssl-key=... --ssl-cert=...

(or)

thrall --enable-ssl --ssl-key-file=... --ssl-cert-file=...

You could run your application behind some webserver like Apache that knows how to safely authenticate users.

To do this, you have two options:

  1. Use FastCGI
  2. Proxy requests to your app.

To go the FastCGI route, use plackup like this:

plackup -s FCGI  myapp.psgi

And in your Apache config, use something like this:

LoadModule fastcgi_module libexec/mod_fastcgi.so
<IfModule mod_fastcgi.c>
    FastCgiExternalServer /tmp/myapp.fcgi -host localhost:5000
    Alias /myapp/    /tmp/myapp.fcgi/
</IfModule>

Alternatively, you can make Apache proxy requests to your app:

ProxyPass /myapp    http://localhost:5000/

Since plackup is not recommended for production systems, you should look into Starman, which will limit your options to the proxy solution.