[solved] Re: proxy problem

Gena Makhomed gmm at csdoc.com
Mon Jun 7 19:17:59 MSD 2010

On 07.06.2010 17:55, lucas at landm.net wrote:

> The problem was an internal redirection from squirrelmail. Doing some
> operation, it redirects to http://server/ [no SSL ]

you need

SetEnv HTTPS on

in apache config for squirrelmail virtual host.

or more advanced code in nginx and apache config:


nginx config:

proxy_set_header X-Nginx-Scheme $scheme;

# nginx variable $scheme will be 'http' or 'https'.

apache config:

SetEnvIf X-Nginx-Scheme "^https$" HTTPS=on

# Apache environment variable HTTPS will be 'on' or not defined.

PHP code:

$scheme = getenv('HTTPS') && strtolower(getenv('HTTPS')) != 'off'
     ? 'https'
     : 'http';

# PHP variable $scheme will be 'http' or 'https'.


check for HTTPS environment variable already implemented inside 
squirrelmail: function is_ssl_secured_connection() in functions\global.php.

P.S. also you need something like

   proxy_redirect    https://mail.example.com:80/ /;

in nginx config, because squirrelmail can make redirects
to 80 port instead of default for HTTPS, 443 port.

Best regards,

More information about the nginx mailing list