Re: general problems with squirrelmail behind

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>
>> Create test script with
>> ---
>> <?php
>> define('SM_PATH','../');
>> include_once(SM_PATH . 'functions/global.php');
>> $location = get_location();
>> $baseurl = sqm_baseuri();
>> var_dump($location);
>> var_dump($baseurl);
>> ?>
>> ---
>> Save it in SquirrelMail 1.4.10a src directory, open
>> https://ssl-proxy.com/mydomain.com/squirrelmail/src/test.php in your
>> browser and check results. First string should show
>> "https://ssl-proxy.com/mydomain.com/squirrelmail/src";, second one should
>> show "/mydomain.com/squirrelmail/". SquirrelMail can fail to identify
>> base
>> url correctly, if your domain name contains "src", "plugins" or
>> "functions"
>
> I created your script and additionally installed Squirrelmail 1.4.10a on
> my server. Previously I used version 1.5.2 as suggested by Paul. I also
> set the $config_location_base variable to
> 'https://ssl-proxy.com/mydomain.com/squirrelmail' in the configuration
> file.
>
> This is the output I am got after running the script:
>
> string 1: string(74)
> "https://ssl-proxy.com/mydomain.com/squirrelmail/squirrelmail/src";
>
> string 2: string(19) "/squirrelmail/"

You have apache mod_rewrite based proxy on https://ssl-proxy.com host or
something similar to it. SquirrelMail does not have any idea about
rewriting rules used by proxy.

in your case https://ssl-proxy.com/mydomain.com proxies
http://mydomain.com urls

in some other case https://ssl-proxy.com/secure-webmail can proxy
http://otherdomain.com/unsecure-webmail

Location base setting allows to set hostname part. It won't help, when
base urls are different. In your case it still works because base url
differs only by proxied hostname. Your location base configuration fixes
detection in SquirrelMail get_location() function. But path detection in
sqm_baseuri() and php_self() functions remains unfixed.

Open SquirrelMail functions/strings.php.
Find lines with
----
   if ( sqgetGlobalVar('PHP_SELF', $php_self, SQ_SERVER) &&
!empty($php_self) ) {

      // need to add query string to end of PHP_SELF to match REQUEST_URI
      //
      if ( sqgetGlobalVar('QUERY_STRING', $query_string, SQ_SERVER) &&
!empty($query_string) ) {
         $php_self .= '?' . $query_string;
      }

      return $php_self;
    }
----

and modify them to
----
   if ( sqgetGlobalVar('PHP_SELF', $php_self, SQ_SERVER) &&
!empty($php_self) ) {

      // need to add query string to end of PHP_SELF to match REQUEST_URI
      //
      if ( sqgetGlobalVar('QUERY_STRING', $query_string, SQ_SERVER) &&
!empty($query_string) ) {
         $php_self .= '?' . $query_string;
      }

      if (sqgetGlobalVar('HTTP_X_FORWARDED_SERVER',$proxy,SQ_SERVER) &&
        $proxy == 'ssl-proxy.com') {
        $php_self = '/mydomain.com' . $php_self;
      }

      return $php_self;
    }
----

Then find lines with
----
function get_location () {

    global $imap_server_type, $config_location_base;
----

and modify them to
----
function get_location () {
    global $imap_server_type, $config_location_base;
    if (sqgetGlobalVar('HTTP_X_FORWARDED_SERVER',$proxy,SQ_SERVER) &&
        $proxy == 'ssl-proxy.com') {
        $config_location_base='https://ssl-proxy.com/mydomain.com';
    }
----

location base must be set to autodetect in SquirrelMail configuration.

After these modifications SquirrelMail should work in
https://ssl-proxy.com/mydomain.com/squirrelmail and in
http://mydomain.com/squirrelmail addresses. Please note that my
suggestions are based on situation reproduced in Apache2 mod_rewrite
setup. If your setup is different, check "Apache Environment" section in
phpinfo() script output. I am using one of server headers to detect
proxied setup. I don't guarantee that all SquirrelMails scripts and
plugins will work correctly. Some plugins might use own path and location
base detection functions.


-- 
Tomas


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
--
squirrelmail-users mailing list
Posting Guidelines: http://www.squirrelmail.org/wiki/MailingListPostingGuidelines
List Address: squirrelmail-users@xxxxxxxxxxxxxxxxxxxxx
List Archives: http://news.gmane.org/thread.php?group=gmane.mail.squirrelmail.user
List Archives:  http://sourceforge.net/mailarchive/forum.php?forum_id=2995
List Info: https://lists.sourceforge.net/lists/listinfo/squirrelmail-users

[Index of Archives]     [Video For Linux]     [Yosemite News]     [Yosemite Photos]     [gtk]     [KDE]     [Cyrus SASL]     [Gimp on Windows]     [Steve's Art]     [Webcams]

  Powered by Linux