Respect subdirectory in authenticate middleware
Merge pull request #2223 from mjbshaw/fix-subdir

Respect subdirectory in authenticate middleware