twilio / OpenVBX

OpenVBX is a web-based open source phone system for business.
http://openvbx.org
Other
702 stars 341 forks source link

SSL fix #329

Closed cameronja closed 9 years ago

cameronja commented 9 years ago

I was having great difficulty loading my install over ssl.

The $_SERVER['HTTPS'] variable wasn't present but there was a $_SERVER['HTTP_X_FORWARDED_PROTO'] variable.

This may occur when using cloudflare. The following code fixes the SSL issue:

$config['base_url']= "http".((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' || $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')? 's' : '') ."://".$config['server_name']. rtrim(WEB_ROOT, '/').'/';

Gipetto commented 9 years ago

Cool. Yeah, this looks like a common issue when serving from behind proxy servers.

I've pushed this change to the develop branch and it'll go out with the next release.