Unbreak dispatch.cgi #528

Closed
wants to merge 1 commit into
from

Projects

None yet

3 participants

@erik-smit

When used through dispatch.cgi, Dancer::Core::Runner::default_config is instantiated by the 'use Dancer2', where PLACK_ENV is not set. This will set DANCER_APPHANDLER default to 'Standalone', which means that dispatch.cgi will not work unless you override Apphandler in your config to PSGI.

@ambs ambs commented on the diff Feb 28, 2014
lib/Dancer2/Core/Runner.pm
my ($self) = @_;
+ if ($self->caller =~ /dispatch.cgi$/) {
@ambs
ambs Feb 28, 2014 PerlDancer member

please set `dispatch.f?cgi$/ as this is needed for fast_cgi too.

@ambs
Member
ambs commented Feb 28, 2014

👍 after the fix pointed above. Cheers

@veryrusty
Member

This issue looks to have the same root cause as #447. The server is initialised during the import method when you use Dancer2. Unfortunately the work on being able to apply settings on import has stalled in #459 (wish I had a tuit to revisit it; but that's unlikely for the next month).

I'm giving this one a 👎 as I think there is a bigger underlying issue to be solved.

@ambs
Member
ambs commented Feb 28, 2014

I agree with you, @veryrusty, but the problem here is: is anybody working on #459 ?
I do not work in Dancer for... what.. three or four months... and that ticket is stalled since then.
Without this fix Dancer2 apps cannot be published under CGI or fcgi. Better to fix it this way putting a comment on #447 to then remove it, than to keep Dancer2 broken.

I think this is the main problem atm with Dancer2. There are major problems needing fixes, but nobody works on them (me included). But the "hacks" to make it work while that problem is addressed are not took in consideration also.

I still prefer a hacked software that works, than one whose architecture is perfect, but doesn't :)

(sorry if this seems a rant, but I lost hours looking to the docs finding out why my Dancer2 app did not work under Apache fcgi!)

@veryrusty
Member

Does the same 'workaround' mentioned in #447, adding a
BEGIN { $ENV{DANCER_APPHANDLER} = 'PSGI';}
statement before the Dancer2 import in the dispatch.f?cgi files also allow publishing under CGI or fcgi ?

If so, this "hack" is unlikely to require undoing if those bigger problems get tackled..

@ambs
Member
ambs commented Feb 28, 2014

Yep, it works. So, it is just a matter of editing the files under skel.

@veryrusty, you in the pull request, or want me to do it?

@veryrusty
Member

Can you please do the Pr @ambs

@ambs
Member
ambs commented Feb 28, 2014

Sure.

@ambs ambs referenced this pull request Feb 28, 2014
Merged

use env to set PSGI #529

@veryrusty
Member

@erik-smit thanks for the initial pull request. This has been resolved with the alternate approach in #529.

@veryrusty veryrusty closed this Mar 1, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment