Hiawatha version: latest
Operating System: linux
Heya. So I will try and populate this with more CMS / e-shops and so on which are PHP based. Make sure your hiawatha rev proxy sends a X-Forward-For header and is used as a ssl temrination point (at least in these examples):
Wordpress 4.1.1:
In wp-config.php, add between DEBUG and require_once settings :
define('WP_DEBUG', false);
...
/* Start insertion
Some rev-proxy magic boo boo sauce.
One should insist on encryption during logins in this day and age. */
define('FORCE_SSL_ADMIN', true);
define('FORCE_SSL_LOGIN', true);
// Check if behind a forwarder
if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$list = explode(',',$_SERVER['HTTP_X_FORWARDED_FOR']);
$_SERVER['REMOTE_ADDR'] = $list[0]; // might be useful for your application
// Finally, add correct scheme state as forwarder/client
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') $_SERVER['HTTPS']='on';
}
...
/* That's all, stop editing! Happy blogging. */
Drupal 7.35:
Install entirely in http, try https, you loose 'formatting'
in sites/default/settings.php:
change the rev proxy settings to true , add your array of rev proxy ip's:
[…]
$conf['reverse_proxy'] = TRUE;
/**
* Specify every reverse proxy IP address in your environment.
* This setting is required if $conf['reverse_proxy'] is TRUE.
*/
$conf['reverse_proxy_addresses'] = array('1.2.3.4');
/**
* Set this value if your proxy server sends the client IP in a header
* other than X-Forwarded-For.
*/
# $conf['reverse_proxy_header'] = 'HTTP_X_CLUSTER_CLIENT_IP';
[…], then also add the following to get https to work:
/* It seems as https is still an issue unfortunately, so try: */
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) &&
$_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' &&
!empty($conf['reverse_proxy']) &&
in_array($_SERVER['REMOTE_ADDR'], $conf['reverse_proxy_addresses'])
) {
$_SERVER['HTTPS'] = 'on';
// if one has any port issues
//$_SERVER['SERVER_PORT'] = 443;
}
Joomla:
install, then in libraries/joomla/uri/uri.php (it could be somewhere else, I guess, but this is where I added it):
find
// Determine if the request was over SSL (HTTPS).
if (isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) != 'off'))
{
$https = 's://';
}
and PREPEND (insert BEFORE) this:
//might be useful
if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$list = explode(',',$_SERVER['HTTP_X_FORWARDED_FOR']);
$_SERVER['REMOTE_ADDR'] = $list[0];
}
// let's flag ssl when frontend sets it
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
$_SERVER['HTTPS']='on';
Hope this helps.
Mina