Open neniu opened 12 years ago
This app has about 6 directories and only one needs to be created dynamically. With the ScriptAlias line in the original post, I was trying to get any request for /member/* to go to the Dancer handler and anything else to get served up directly by Apache.
Since that was not working and in an attempt to get this working at all, I thought to have Dancer service any request and get the 'autopage' magic in Dancer to pass everything other than /members/* through.
To that end, I changed the Apache config to, in part
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ /www/appdir/cgi-bin/dispatch.cgi/$1 [QSA,L]
Now, nothing outside /members works at all; it gets a 'This is the void' error (which is really funny the first thousand times you see it). I am not worried about that; it is probably just a matter of the right RewriteRule or changing a URL or path so that they match.
What does bother me is that the POST variables are still being lost. They do not appear in the Dancer::Request but the content_length is still 17 which suggests that they made it as far as the server but got lost somewhere there.
I tried adding "H=cgi-script" to the RewriteRule flags but that made no difference.
I was using Dance 1.2something when I first posted this. I have since upgrade to 1.3091 and the result is the same.
Pastebin provided by @neniu containing a dump of the Dancer::Request
object: http://pastebin.com/7b2fQWJ3
Hmm - that's strange - as you say, it shows a Content-Length of 17, which is correct for uname=aa&pword=aa
.
I shall try to reproduce this with a CGI setup similar to yours.
I'd be interested to confirm that request->is_post
correctly returns a true value. Also, it looks like the HTTP::Body
object has no content, which is odd; I'd be interested what request->body
returns, too.
is_post returns 1. body returns ''. Lines 112 and 113 of http://pastebin.com/x4gW8pw6
I also now seem to be losing form variables deployed under Plack. It is not 100% of the time as it was when I tried deploying but it is waaaay more than the acceptable maximum of 0%. I have not noticed the content length of the body when that happens though so I can not say for sure whether the body content/form variables are even making it to the server.
I have a Dancer app with a login form. I have the app deployed as CGI under Apache and everything seems to be working except that POST variables are not arriving at the handler code.
The login form has the default enc-type and fields 'uname' and 'pword'. Firebug confirms that the parameters are present in the POST. If I run a logging proxy of my desktop machine, it confirms that the content is 'uname=aa&pword=aa' and that the content length is 17. In the route handler code, request->params() returns nothing. Dumping the Dancer::Request object shows params to be empty ( {} ). The content_length attribute of the Dancer::Request object is 17 though. The content gets as far as the server but is not making it to my code.
When running the Dancer app.pl stand-alone, this works perfectly. It is only when running it under the main web server that it fails.
None of the deployment instructions have worked for me, under CGI or otherwise. The closest I have managed is ScriptAlias /members /www/appdir/cgi-bin/dispatch.cgi in the section of the config file.
(Only the /members section of the site is Dancer, the rest is served statically.)
I have not tried this with any other form in the application.
It took me so long to get this working under apache at all that feels like I have done the brain surgery successfully but can't remember how to stitch the incision shut.
Thank you.