[ZendTo] IIS7 reverse proxy (small bug and fix)

David Turvey dturvey at bhc.ltd.uk
Tue Apr 2 11:36:28 BST 2013


Hi,

I came across a small bug while running zend.to behind a IIS7 reverse proxy. The user would be able to login successfully but the next click would return to a logged out state. 

I tracked this down to IIS7 adding a port number to the REMOTE_ADDR server variable. This is added to the cookie. The current cookie parsing in NSSDropBox.php-> userFromCookie() doesn't handle this case.

Changing the preg_match call to the following seems to fix the issue. Note the new non-capturing group in the regex.
    preg_match('/^(.+)\,([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+(?:\:[0-9]+)?),([0-9]+),([0-9]+),([A-Fa-f0-9]+)$/',$cookieVal,$cookiePieces)

I hope this workaround could be of benefit to others and possible get added into the main code base.

Thanks

--
David Turvey
IT

BHC Ltd, Medwyn Park, Edinburgh Road,Carnwath, ML11 8HS
01555 840006
www.bhc.ltd.uk




More information about the ZendTo mailing list