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?


In reply to Can not Dance on Windows by FreeBeerReekingMonk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.