Created
April 28, 2014 10:36
-
-
Save digitales/11368046 to your computer and use it in GitHub Desktop.
FastCGI authentication header fix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Drew FastCGI authentication | |
* Description: This works along side the .htaccess to support the PHP_AUTH_PW that are stripped by the PHP FastCGI process | |
* Author: Ross Tweedie | |
* Author URI: http://drewlondon.co.uk/ | |
* Version: 0.1 | |
* Plugin URI: | |
*/ | |
if( isset( $_SERVER['PHP_AUTH_DIGEST_RAW'] ) ){ | |
list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = | |
explode(':', base64_decode(substr($_SERVER['PHP_AUTH_DIGEST_RAW'], 6))); | |
} | |
/** | |
To go in the .htaccess | |
<IfModule mod_env.c> | |
SetEnvIfNoCase ^Authorization$ "(.+)" PHP_AUTH_DIGEST_RAW=$1 | |
</IfModule> | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment