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

I developed a web application in Dancer2. As plackup does not https, I wanted an Apache 2.4 frontend to do the securing. Then it went downhill. ApacheLounge does not provide a mod_proxy_psgi, compiling it with the same (MSVC14) as Apache, it goes quickly down a INC dependency hole that made me install cygwin with all the dev headers libs... but I was not able to compile it. I then tried mod_proxy_fcgi (and mod_fcgi), but that requires Dancer to be served by Starman or similar. Unfortunately, Starman does not work on Windows. I then went for the regular cgi, which is still there. Here is where it gets weird:

I found an apache rule to execute the cgi if it does not contain a dot in the name , everything with a dot is served directly by Apache, so it is not that slow... As I wanted to capture the name, instead of !\. I have ^(/^\.*)$ and the H= means that it treats this rewrite as a cgi script, the E adds a new variable to %ENV

RewriteRule ^(/[^\.]*)$ "C:/myapp/public/dispatch.cgi" [E=MYPATH_INFO:$1,H=cgi-script]

However, in app.pm, request->dispatch_path, a constant which can not be modified is always "/" while $ENV{PATH_INFO} and request->path do contain the right path. This means get "/" => sub{} is always running, even if we want to go to other pages.

By doing a get '/mypage' => $SUBROUTINE{'/mypage'} = sub {....} we can keep the plackup version working, and have the sub in a hash, to serve at / when this anomaly is detected. However, it has other problems, like the browser getting recursively redirected to /login/login/login...etc.. (code snippet will follow as soon as I have time to make a small selfcontained example).

So my question: Any monks successfully implemented Dancer2 applications under Apache on Windows?

Replies are listed 'Best First'.
Re: Can not Dance on Windows
by Anonymous Monk on Dec 07, 2016 at 08:51 UTC

    but that requires Dancer to be served by Starman or similar. Unfortunately, Starman does not work on Windows.

    Why do the docs talk about plackup -s FCGI ?

      Because when you install the requirement cpanm --verbose --interactive FCGI::ProcManager on Windows (with StrawberryPerl), it dies with:

      procmanager.t .. Your vendor has not defined POSIX macro SA_RESTART

      Some would try ActiveState Perl, which should be able to overcome this. I rather search for a solution inside Strawberry first.

        If SA_RESTART is missing, it wouldn't matter much which flavor of windows perl you're running

        There are other FCGI things to try FCGI::Engine/FCGI::Async