LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > General > 404 Error trying to use Roundcube webmail ???

Reply
 
Thread Tools Display Modes
  #1  
Old 01-29-2008, 10:00 PM
phallstrom phallstrom is offline
Member
 
Join Date: Jan 2007
Posts: 28
Default 404 Error trying to use Roundcube webmail ???

Hi -

I've installed roundcube webmail and am getting a weird error... when it makes AJAX calls it makes them to a URL like this:

GET https://.....com/roundcubemail/?_task=mail.....

and I'm getting a 404. Which is odd because if I drop the "?_..." then the page loads (the homepage of roundcube) just fine. That is "https://.....com/roundcubemail/" works. So does "https://.....com/roundcubemail/?".

"https://.....com/roundcubemail/index.php?_task=mail....." doesn't give me a 404. Not sure what it's supposed to outside of an AJAX call, but at least no 404.

I'm going bonkers.

I'm using an instantiated "phpsuexec" template on 3.3.4 on ubuntu gutsy.

Can anyone think of where to look in the configuration?

Thanks!
Reply With Quote
  #2  
Old 01-29-2008, 10:50 PM
phallstrom phallstrom is offline
Member
 
Join Date: Jan 2007
Posts: 28
Default Hrm... I think I see why, but how to fix?

So, in digging through the roundcube source I see this:

// check client X-header to verify request origin
if ($OUTPUT->ajax_call)
{
if (empty($CONFIG['devel_mode']) && !rc_request_header('X-RoundCube-Referer'))
{
header('HTTP/1.1 404 Not Found');
die("Invalid Request");
}
}

And I changed that "die" line to spit out "ARGH" and sure enough that's the spot I'm hitting.

So, not knowing much about the code, I'm guessing that litespeed is stripping out the X-RoundCube-Referer header and that isn't making it into PHP.

Is there a way to make sure that gets passed in?

Thanks!
Reply With Quote
  #3  
Old 01-30-2008, 09:32 AM
phallstrom phallstrom is offline
Member
 
Join Date: Jan 2007
Posts: 28
Default Figured it out! -- READ THIS LITESPEED STAFF (bug in the phplsapi module)

Hey all -

I figured it out. In another section of the code it is calling the php function "getallheaders". Docs: http://us3.php.net/getallheaders

They say " This function is an alias for apache_request_headers(). Please read the apache_request_headers() documentation for more information on how this function works. This function is only supported when PHP is installed as an Apache module."

However, when I run the following code "function_exists('getallheaders')" via litespeed it returns true. So litespeed isn't undefining that function, but letting it work -- however it doesn't return *any* of the headers.

So either litespeed needs to modify that function to return the headers or unset it.

I added a "if that function exists and the php sapi is not litespeed" check in the code and it works great now.
Reply With Quote
  #4  
Old 01-30-2008, 10:12 AM
xing xing is offline
LiteSpeed Staff
 
Join Date: Oct 2003
Location: Los Angeles, California
Posts: 380
This is not a bug. The PHP.net documentation clearly states this function is an alias for apache_* function which only works when php is used as an apache module.

More over, the roundcube developers, are using seldomly used platform specific php function when they can use and access the $_SERVER[HTTP_*] variables for exactly the same thing but compatible with every other web server, not just apache. In another words, bad programming.

Please look at the comments below the docs at : http://us3.php.net/manual/en/functio...st-headers.php
Reply With Quote
  #5  
Old 01-30-2008, 10:23 AM
xing xing is offline
LiteSpeed Staff
 
Join Date: Oct 2003
Location: Los Angeles, California
Posts: 380
To clarify, you need to not only check wether apache_* exists but check the return result

if(function_exists('apache_xx') && !apache_xx()) {
//use apache_
}
else {
//use standard method of $_SERVER[HTTP_]
}
Reply With Quote
  #6  
Old 01-30-2008, 10:24 AM
phallstrom phallstrom is offline
Member
 
Join Date: Jan 2007
Posts: 28
"This function is only supported when PHP is installed as an Apache module."

I suppose that can be read either way... I read it as "it's the sapi's responsibility to disable that function unless it's apache". But I suppose reading it the other way "only call this if you've first checked to make sure your running under the apache sapi" works as well

They do have a check in there and if getallheaders() isn't defined access the headers directly.

So I suppose you're right. It's not so much an issue with litespeed as an issue with *all* sapi's that aren't apache.

Anyway, the good news is that the next person who hits this will find this post and know the fix
Reply With Quote
  #7  
Old 01-30-2008, 02:42 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
It has been fixed in our latest php-litespeed SAPI 4.5 release.
Added implementation of getallheaders() and apache_request_headers()
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 08:35 AM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.