How to override core is_ssl() function?

If you look at the source of the is_ssl() function you’ll see it checks various $_SERVER variables. Therefore, you could try adding this to a plugin:

if ( isset( $_SERVER['HTTP_MY_CUSTOM_HEADER'] ) )
  $_SERVER['HTTPS'] = 'on';

You’d need to call that code as early as possible, ie. directly in the plugin body rather than on a hook.

Leave a Comment