+htp #15922 import FileAndResourceDirectives from spray

Based on #16183 + #16195. So, please review just the last commit. I will rebase once the other PRs are merged.

Fixes #15922.

/cc @sirthias @hseeberger
That was unexpected. Didn't know that the scope key wiped the scope completely. Nice find.