<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi,<div><br><div><div>On 23 Jul 2008, at 10:27, Phillip B Oldham wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">mike wrote:<br><blockquote type="cite">like PHP_AUTH_USER that Apache gives you and stuff?<br></blockquote><blockquote type="cite"> &nbsp;<br></blockquote>Yep, just like that.</blockquote><div><br></div>I could be wrong but I think that this only happens once Apache has already done the authorisation and granted access to the resource.<br><div><br></div><blockquote type="cite"><blockquote type="cite">you can do it purely in PHP:<br></blockquote><blockquote type="cite"><a href="http://www.php.net/features.http-auth">http://www.php.net/features.http-auth</a><br></blockquote>I thought nginx would have to pass the user/pass through to PHP via the fastcgi params?<br></blockquote><br></div><div>As I understand it, if PHP sends&nbsp;<font class="Apple-style-span" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;">HTTP/1.1 401 Unauthorized</span></font>&nbsp;then the browser should ask the user for credentials, and then send them back through the <font class="Apple-style-span" size="2"><span class="Apple-style-span" style="font-size: 10px;">Authorization</span></font> header. If this is in a location block without <font class="Apple-style-span" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;">auth_basic</span></font>, then nginx will pass this header through to PHP, and PHP can base64-decode the credentials, do what it needs to do in order to work out whether they're good credentials, and then return a 200 or another 401 appropriately. You may need to set <font class="Apple-style-span" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;">fastcgi_pass_header Authorization</span></font>, I'm not sure - I've seen this referred to in various nginx configs on the web but the version of nginx I have on hand to test (0.5.35) seems to pass the <font class="Apple-style-span" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;">HTTP_AUTHORIZATION</span></font> header through with or without this setting.</div><div><br></div><div>Cheers</div><div>i</div><div><br></div><div apple-content-edited="true"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>--</div><div>Igor Clark • POKE • 10 Redchurch Street • E2 7DD • +44 (0)20 7749 5355 • <a href="http://www.pokelondon.com">www.pokelondon.com</a></div></div></div></div></div></div></div></div></div></div></span></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"> </div><br></div></body></html>